Version Notes
Enhancements:
0.1.15:
Support for more configuration options: redemption url and gift description.
0.1.13:
Removed exception printouts
0.1.12:
Revised pricing definition via catalog product definition
0.1.11:
Revised Pricing rules via getFinalPrice
0.1.10:
Disable pricing rules
0.1.9:
Re-factor and extended diagnostics
0.1.8:
Removed changes to administrative view of gift cards (causing out-of-memory errors for large databases)
0.1.7:
Fixed: removed more logging messages.
0.1.6:
Fixed: removed some logging messages.
0.1.5:
- Giftwrap price appears on product page
0.1.4:
- admin view of delivery method
Fixed bug:
- delivery option displays as a numerical value instead of description on the Order Review screen
0.1.3:
- Improved analytics
- Settable giftwrap price
Release Info
Developer | James Barabas |
Extension | Delightfully_WrappedGiftCard |
Version | 0.1.15 |
Comparing to | |
See all releases |
Version 0.1.15
- app/code/community/Delightfully/WrappedGiftCard/Block/Adminhtml/Giftvoucher.php +8 -0
- app/code/community/Delightfully/WrappedGiftCard/Block/Adminhtml/Giftvoucher/Grid.php +20 -0
- app/code/community/Delightfully/WrappedGiftCard/Block/Cart/Item.php +12 -0
- app/code/community/Delightfully/WrappedGiftCard/Block/Multishipping/Wrappedgiftcard.php +144 -0
- app/code/community/Delightfully/WrappedGiftCard/Block/Product/View.php +8 -0
- app/code/community/Delightfully/WrappedGiftCard/Block/Wrappedgiftcard.php +138 -0
- app/code/community/Delightfully/WrappedGiftCard/Helper/Data.php +200 -0
- app/code/community/Delightfully/WrappedGiftCard/Helper/Giftvoucher/Data.php +12 -0
- app/code/community/Delightfully/WrappedGiftCard/Model/Giftvoucher.php +68 -0
- app/code/community/Delightfully/WrappedGiftCard/Model/Giftvoucher/Observer.php +54 -0
- app/code/community/Delightfully/WrappedGiftCard/Model/Giftvoucher/Price.php +105 -0
- app/code/community/Delightfully/WrappedGiftCard/Model/Observer.php +70 -0
- app/code/community/Delightfully/WrappedGiftCard/Model/WrappedGiftCard.php +9 -0
- app/code/community/Delightfully/WrappedGiftCard/etc/config.xml +130 -0
- app/code/community/Delightfully/WrappedGiftCard/etc/system.xml +83 -0
- app/design/adminhtml/default/default/layout/delightfully/wrappedgiftcard.xml +11 -0
- app/design/frontend/base/default/layout/delightfully/wrappedgiftcard.xml +49 -0
- app/design/frontend/base/default/template/delightfully/wrappedgiftcard/multishipping/wrappedgiftcard.phtml +132 -0
- app/design/frontend/base/default/template/delightfully/wrappedgiftcard/product/view.phtml +188 -0
- app/design/frontend/base/default/template/delightfully/wrappedgiftcard/wrappedgiftcard.phtml +148 -0
- app/etc/modules/Delightfully_WrappedGiftCard.xml +21 -0
- package.xml +64 -0
- skin/frontend/base/default/delightfully/wrappedgiftcard/css/wrappedgiftcard.css +0 -0
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Delightfully_WrappedGiftCard_Block_Adminhtml_Giftvoucher extends Magestore_Giftvoucher_Block_Adminhtml_Giftvoucher {
|
3 |
+
public function __construct()
|
4 |
+
{
|
5 |
+
parent::__construct();
|
6 |
+
$this->_blockGroup = 'delightfully_wrappedgiftcard';
|
7 |
+
}
|
8 |
+
}
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class Delightfully_WrappedGiftCard_Block_Adminhtml_Giftvoucher_Grid extends Magestore_Giftvoucher_Block_Adminhtml_Giftvoucher_Grid {
|
5 |
+
protected function _prepareColumns()
|
6 |
+
{
|
7 |
+
|
8 |
+
$this->addColumn('giftvoucher_comments', array(
|
9 |
+
'header' => Mage::helper('giftvoucher')->__('Comments'),
|
10 |
+
'align' =>'left',
|
11 |
+
'index' =>'giftvoucher_comments',
|
12 |
+
'filter_index' => 'main_table.giftvoucher_comments'
|
13 |
+
));
|
14 |
+
|
15 |
+
//$this->addExportType('*/*/exportCsv', Mage::helper('giftvoucher')->__('CSV'));
|
16 |
+
//$this->addExportType('*/*/exportXml', Mage::helper('giftvoucher')->__('XML'));
|
17 |
+
|
18 |
+
return parent::_prepareColumns();
|
19 |
+
}
|
20 |
+
}
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Delightfully_WrappedGiftCard_Block_Cart_Item extends Magestore_Giftvoucher_Block_Cart_Item {
|
3 |
+
|
4 |
+
//shim to show friendly version of product options in cart instead of internal send_friend code
|
5 |
+
public function getProductOptions(){
|
6 |
+
$options = parent::getProductOptions(); //get default relevant translated option labels & values
|
7 |
+
|
8 |
+
$dhelper = Mage::helper('delightfully_wrappedgiftcard');
|
9 |
+
|
10 |
+
return $dhelper->extendOptionsWithDeliveryMethod($options); //edit options to include correct names for delivery options
|
11 |
+
}
|
12 |
+
}
|
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Delightfully_WrappedGiftCard_Block_Multishipping_Wrappedgiftcard extends Mage_Checkout_Block_Multishipping_Success {
|
3 |
+
|
4 |
+
public function getOrder() {
|
5 |
+
return Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
|
6 |
+
}
|
7 |
+
|
8 |
+
public function getOrderByIncrementId($incrementId) {
|
9 |
+
return Mage::getModel('sales/order')->loadByIncrementId($incrementId);
|
10 |
+
}
|
11 |
+
|
12 |
+
|
13 |
+
public function getOrderById($id) {
|
14 |
+
$orders = Mage::getModel('sales/order')
|
15 |
+
->getCollection()
|
16 |
+
->addAttributeToFilter('state', array('neq' => Mage_Sales_Model_Order::STATE_CANCELED))
|
17 |
+
->addAttributeToFilter('increment_id', id)
|
18 |
+
->getFirstItem();
|
19 |
+
return $orders;
|
20 |
+
}
|
21 |
+
|
22 |
+
public function getOrderedProduct($ordered_product) {
|
23 |
+
return Mage::getModel('catalog/product')->load($ordered_product->getProductId());
|
24 |
+
}
|
25 |
+
|
26 |
+
public function getStoreName() {
|
27 |
+
return Mage::getStoreConfig('general/store_information/name');
|
28 |
+
}
|
29 |
+
public function countWrappedCardsInOrderItems($items) {
|
30 |
+
$prescan = 0;
|
31 |
+
foreach ( $items as $item ) {
|
32 |
+
if($this->isWrappedGiftCard($item)) {
|
33 |
+
$prescan = $prescan + $this->countGiftCodes($item);
|
34 |
+
}
|
35 |
+
}
|
36 |
+
return $prescan;
|
37 |
+
}
|
38 |
+
|
39 |
+
public function countGiftCodes($item) {
|
40 |
+
if($this->isWrappedEnterpriseGiftCard($item)) {
|
41 |
+
return 1;
|
42 |
+
}
|
43 |
+
if($this->isWrappedMagestoreGiftVoucher($item)) {
|
44 |
+
return $this->countMagestoreGiftVoucherCodes($item);
|
45 |
+
}
|
46 |
+
return 0;
|
47 |
+
}
|
48 |
+
|
49 |
+
public function countMagestoreGiftVoucherCodes($item) {
|
50 |
+
$dhelper = Mage::helper('delightfully_wrappedgiftcard');
|
51 |
+
return count($dhelper->getVoucherCodesForItem($item));
|
52 |
+
}
|
53 |
+
|
54 |
+
public function isWrappedEnterpriseGiftCard($item) {
|
55 |
+
//check if matches by DLYGC SKU
|
56 |
+
return preg_match('/DLYGC/',$item->_data['sku']);
|
57 |
+
}
|
58 |
+
|
59 |
+
public function isWrappedMagestoreGiftVoucher($item) {
|
60 |
+
//check if matches by type
|
61 |
+
$prodtype = $item->_data['product_type'];
|
62 |
+
if('giftvoucher' == $prodtype) {
|
63 |
+
//check if voucher gift has Delightfully wrapping selected.
|
64 |
+
$opts = $item->getProductOptionByCode('info_buyRequest');
|
65 |
+
if($opts['send_friend'] == 2) {
|
66 |
+
return true;
|
67 |
+
}
|
68 |
+
}
|
69 |
+
return false;
|
70 |
+
}
|
71 |
+
|
72 |
+
public function isWrappedGiftCard($item) {
|
73 |
+
if($this->isWrappedEnterpriseGiftCard($item)) {
|
74 |
+
return true;
|
75 |
+
}
|
76 |
+
if($this->isWrappedMagestoreGiftVoucher($item)) {
|
77 |
+
return true;
|
78 |
+
}
|
79 |
+
return false;
|
80 |
+
}
|
81 |
+
|
82 |
+
public function getAPIParamsForItem($item,$transaction,$count,$codenum) {
|
83 |
+
if($this->isWrappedEnterpriseGiftCard($item)) {
|
84 |
+
return $this->getAPIParamsForEnterpriseGiftCard($item,$transaction,$count,$codenum);
|
85 |
+
}
|
86 |
+
if($this->isWrappedMagestoreGiftVoucher($item)) {
|
87 |
+
return $this->getAPIParamsForMagestoreGiftVoucher($item,$transaction,$count,$codenum);
|
88 |
+
}
|
89 |
+
return array();
|
90 |
+
}
|
91 |
+
|
92 |
+
public function getAPIParamsForEnterpriseGiftCard($item,$transaction,$count,$codenum) {
|
93 |
+
|
94 |
+
$dhelper = Mage::helper('delightfully_wrappedgiftcard');
|
95 |
+
$params = $dhelper->getBaseAPIParams();
|
96 |
+
|
97 |
+
$opt = $item->getProductOptions();
|
98 |
+
$code = "PENDING";
|
99 |
+
$codes = $opt['giftcard_created_codes'];
|
100 |
+
if($codes[$codenum]) $code = $codes[$codenum];
|
101 |
+
|
102 |
+
$params['sender'] = $opt['giftcard_sender_name'];
|
103 |
+
$params['recipient'] = $opt['giftcard_recipient_name'];
|
104 |
+
$params['from'] = $opt['giftcard_sender_email'];
|
105 |
+
$params['to'] = $opt['giftcard_recipient_email'];
|
106 |
+
$params['message'] = $opt['giftcard_message'];
|
107 |
+
$params['code'] = $code;
|
108 |
+
$txn = "".$transaction . "_" . $count . "_" . $code;
|
109 |
+
$params['transaction'] = $txn;
|
110 |
+
return $params;
|
111 |
+
}
|
112 |
+
|
113 |
+
public function getAPIParamsForMagestoreGiftVoucher($item,$transaction,$count, $codenum) {
|
114 |
+
|
115 |
+
$dhelper = Mage::helper('delightfully_wrappedgiftcard');
|
116 |
+
|
117 |
+
$description = Mage::getStoreConfig('delightfully_options/product/gift_description');
|
118 |
+
|
119 |
+
$params = $dhelper->getBaseAPIParams();
|
120 |
+
|
121 |
+
|
122 |
+
$opt = $item->getProductOptions();
|
123 |
+
$code = "PENDING";
|
124 |
+
$codes = $dhelper->getVoucherCodesForItem($item);
|
125 |
+
$sender = $dhelper->getSenderParamsForItem($item);
|
126 |
+
|
127 |
+
if($codes[$codenum]) $code = $codes[$codenum];//can be multiple codes in same item
|
128 |
+
|
129 |
+
$params['sender'] = $sender['sender'];
|
130 |
+
$params['recipient'] = $opt['info_buyRequest']['recipient_name'];
|
131 |
+
$params['from'] = $sender['from'];
|
132 |
+
$params['to'] = $opt['info_buyRequest']['recipient_email'];
|
133 |
+
$params['message'] = $opt['info_buyRequest']['message'];
|
134 |
+
$params['code'] = $code;
|
135 |
+
$txn = "".$transaction . "_" . $count . "_" . $code;
|
136 |
+
$params['transaction'] = $txn;
|
137 |
+
$paramas['value'] = $sender['value'];
|
138 |
+
$params['description'] = $sender['amount'] . " " .$description;
|
139 |
+
$params['schedule'] = $opt['info_buyRequest']['day_to_send'];
|
140 |
+
return $params;
|
141 |
+
}
|
142 |
+
|
143 |
+
}
|
144 |
+
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Delightfully_WrappedGiftCard_Block_Product_View extends Magestore_Giftvoucher_Block_Product_View {
|
3 |
+
|
4 |
+
public function getGiftAmount($product){
|
5 |
+
return parent::getGiftAmount($product);
|
6 |
+
}
|
7 |
+
|
8 |
+
}
|
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Delightfully_WrappedGiftCard_Block_Wrappedgiftcard extends Mage_Checkout_Block_Onepage_Success {
|
3 |
+
public function getOrder() {
|
4 |
+
return Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
|
5 |
+
}
|
6 |
+
|
7 |
+
public function getOrderedProduct($ordered_product) {
|
8 |
+
return Mage::getModel('catalog/product')->load($ordered_product->getProductId());
|
9 |
+
}
|
10 |
+
|
11 |
+
public function getStoreName() {
|
12 |
+
return Mage::getStoreConfig('general/store_information/name');
|
13 |
+
}
|
14 |
+
|
15 |
+
public function countWrappedCardsInOrderItems($items) {
|
16 |
+
$prescan = 0;
|
17 |
+
foreach ( $items as $item ) {
|
18 |
+
if($this->isWrappedGiftCard($item)) {
|
19 |
+
$prescan = $prescan + $this->countGiftCodes($item);
|
20 |
+
}
|
21 |
+
}
|
22 |
+
return $prescan;
|
23 |
+
}
|
24 |
+
|
25 |
+
public function countGiftCodes($item) {
|
26 |
+
if($this->isWrappedEnterpriseGiftCard($item)) {
|
27 |
+
return 1;
|
28 |
+
}
|
29 |
+
if($this->isWrappedMagestoreGiftVoucher($item)) {
|
30 |
+
return $this->countMagestoreGiftVoucherCodes($item);
|
31 |
+
}
|
32 |
+
return 0;
|
33 |
+
}
|
34 |
+
|
35 |
+
public function countMagestoreGiftVoucherCodes($item) {
|
36 |
+
$dhelper = Mage::helper('delightfully_wrappedgiftcard');
|
37 |
+
return count($dhelper->getVoucherCodesForItem($item));
|
38 |
+
}
|
39 |
+
|
40 |
+
public function isWrappedEnterpriseGiftCard($item) {
|
41 |
+
//check if matches by DLYGC SKU
|
42 |
+
return preg_match('/DLYGC/',$item->_data['sku']);
|
43 |
+
}
|
44 |
+
|
45 |
+
public function isAnyMagestoreGiftVoucher($item) {
|
46 |
+
$prodtype = $item->_data['product_type'];
|
47 |
+
return ('giftvoucher' == $prodtype);
|
48 |
+
}
|
49 |
+
|
50 |
+
public function isWrappedMagestoreGiftVoucher($item) {
|
51 |
+
//check if matches by type
|
52 |
+
$prodtype = $item->_data['product_type'];
|
53 |
+
if('giftvoucher' == $prodtype) {
|
54 |
+
//check if voucher gift has Delightfully wrapping selected.
|
55 |
+
$opts = $item->getProductOptionByCode('info_buyRequest');
|
56 |
+
if($opts['send_friend'] == 2) {
|
57 |
+
return true;
|
58 |
+
}
|
59 |
+
}
|
60 |
+
return false;
|
61 |
+
}
|
62 |
+
|
63 |
+
public function isWrappedGiftCard($item) {
|
64 |
+
if($this->isWrappedEnterpriseGiftCard($item)) {
|
65 |
+
return true;
|
66 |
+
}
|
67 |
+
if($this->isWrappedMagestoreGiftVoucher($item)) {
|
68 |
+
return true;
|
69 |
+
}
|
70 |
+
return false;
|
71 |
+
}
|
72 |
+
|
73 |
+
public function getAPIParamsForItem($item,$transaction,$count,$codenum) {
|
74 |
+
if($this->isWrappedEnterpriseGiftCard($item)) {
|
75 |
+
return $this->getAPIParamsForEnterpriseGiftCard($item,$transaction,$count,$codenum);
|
76 |
+
}
|
77 |
+
if($this->isWrappedMagestoreGiftVoucher($item)) {
|
78 |
+
return $this->getAPIParamsForMagestoreGiftVoucher($item,$transaction,$count,$codenum);
|
79 |
+
}
|
80 |
+
return array();
|
81 |
+
}
|
82 |
+
|
83 |
+
public function getAPIParamsForEnterpriseGiftCard($item,$transaction,$count,$codenum) {
|
84 |
+
|
85 |
+
|
86 |
+
$dhelper = Mage::helper('delightfully_wrappedgiftcard');
|
87 |
+
$params = $dhelper->getBaseAPIParams();
|
88 |
+
|
89 |
+
$opt = $item->getProductOptions();
|
90 |
+
$code = "PENDING";
|
91 |
+
$codes = $opt['giftcard_created_codes'];
|
92 |
+
if($codes[$codenum]) $code = $codes[$codenum];
|
93 |
+
|
94 |
+
$params['sender'] = $opt['giftcard_sender_name'];
|
95 |
+
$params['recipient'] = $opt['giftcard_recipient_name'];
|
96 |
+
$params['from'] = $opt['giftcard_sender_email'];
|
97 |
+
$params['to'] = $opt['giftcard_recipient_email'];
|
98 |
+
$params['message'] = $opt['giftcard_message'];
|
99 |
+
$params['code'] = $code;
|
100 |
+
|
101 |
+
$txn = "".$transaction . "_" . $count . "_" . $code;
|
102 |
+
$params['transaction'] = $txn;
|
103 |
+
return $params;
|
104 |
+
}
|
105 |
+
|
106 |
+
public function getAPIParamsForMagestoreGiftVoucher($item,$transaction,$count, $codenum) {
|
107 |
+
|
108 |
+
|
109 |
+
$dhelper = Mage::helper('delightfully_wrappedgiftcard');
|
110 |
+
|
111 |
+
|
112 |
+
$description = Mage::getStoreConfig('delightfully_options/product/gift_description');
|
113 |
+
|
114 |
+
$params = $dhelper->getBaseAPIParams();
|
115 |
+
|
116 |
+
|
117 |
+
$opt = $item->getProductOptions();
|
118 |
+
$code = "PENDING";
|
119 |
+
$codes = $dhelper->getVoucherCodesForItem($item);
|
120 |
+
$sender = $dhelper->getSenderParamsForItem($item);
|
121 |
+
|
122 |
+
if($codes[$codenum]) $code = $codes[$codenum];//can be multiple codes in same item
|
123 |
+
|
124 |
+
$params['sender'] = $sender['sender'];
|
125 |
+
$params['recipient'] = $opt['info_buyRequest']['recipient_name'];
|
126 |
+
$params['from'] = $sender['from'];
|
127 |
+
$params['to'] = $opt['info_buyRequest']['recipient_email'];
|
128 |
+
$params['message'] = $opt['info_buyRequest']['message'];
|
129 |
+
$params['code'] = $code;
|
130 |
+
$txn = "".$transaction . "_" . $count . "_" . $code;
|
131 |
+
$params['transaction'] = $txn;
|
132 |
+
$paramas['value'] = $sender['value'];
|
133 |
+
$params['description'] = $sender['amount'] . " " .$description;
|
134 |
+
$params['schedule'] = $opt['info_buyRequest']['day_to_send'];
|
135 |
+
return $params;
|
136 |
+
}
|
137 |
+
|
138 |
+
}
|
@@ -0,0 +1,200 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Delightfully_WrappedGiftCard_Helper_Data extends Mage_Core_Helper_Abstract {
|
3 |
+
|
4 |
+
|
5 |
+
public function extendOptionsWithDeliveryMethod($options) {
|
6 |
+
|
7 |
+
$optionLabels = Mage::helper('giftvoucher')->getGiftVoucherOptions(); //get all translated label names
|
8 |
+
|
9 |
+
$found = false;
|
10 |
+
|
11 |
+
//find the option with translated name matching send_friend internal name
|
12 |
+
foreach ($options as $index=>$value) {
|
13 |
+
if ($options[$index] && $options[$index]['label'] == $optionLabels['send_friend']) {
|
14 |
+
$found = true;
|
15 |
+
}
|
16 |
+
}
|
17 |
+
$extraOptions = array();
|
18 |
+
if(!$found) {
|
19 |
+
$extraOptions[] = array('label' => $optionLabels['send_friend'],'value' => 0); //show default if no options set
|
20 |
+
}
|
21 |
+
$options = array_merge($extraOptions,$options);
|
22 |
+
|
23 |
+
//rewrite option value for send_friend option
|
24 |
+
foreach ($options as $index=>$value) {
|
25 |
+
if ($options[$index] && $options[$index]['label'] == $optionLabels['send_friend']) {
|
26 |
+
$sendval = $options[$index]['value'];
|
27 |
+
|
28 |
+
if($sendval == 1) {
|
29 |
+
$options[$index]['value'] = __('Email to Friend');
|
30 |
+
} else if($sendval == 2) {
|
31 |
+
$options[$index]['value'] = __('Virtual Gift Wrap (after checkout)');
|
32 |
+
} else {
|
33 |
+
$options[$index]['value'] = __('Email to Purchaser');
|
34 |
+
}
|
35 |
+
$found = true;
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
return $options;
|
40 |
+
}
|
41 |
+
|
42 |
+
public function addItemFilter($collection, $itemId){
|
43 |
+
if ($collection->hasFlag('add_item_filer') && $collection->getFlag('add_item_filer')) return $collection;
|
44 |
+
$collection->setFlag('add_item_filer',true);
|
45 |
+
|
46 |
+
$collection->getSelect()->joinLeft(
|
47 |
+
array('history' => $collection->getTable('giftvoucher/history')),
|
48 |
+
'main_table.giftvoucher_id = history.giftvoucher_id',
|
49 |
+
array('order_item_id')
|
50 |
+
)->where('history.order_item_id = ?',$itemId)
|
51 |
+
->where('history.action = ?',Magestore_Giftvoucher_Model_Actions::ACTIONS_CREATE);
|
52 |
+
|
53 |
+
return $collection;
|
54 |
+
}
|
55 |
+
|
56 |
+
//TODO: Remove (dupe)
|
57 |
+
public function getVoucherCodes($item) {
|
58 |
+
|
59 |
+
if ($options = $item->getProductOptionByCode('info_buyRequest'))
|
60 |
+
foreach (Mage::helper('giftvoucher')->getGiftVoucherOptions() as $code=>$label)
|
61 |
+
if ($options[$code])
|
62 |
+
$result[] = array(
|
63 |
+
'label' => $label,
|
64 |
+
'value' => $options[$code],
|
65 |
+
'option_value' => $options[$code],
|
66 |
+
);
|
67 |
+
$collection = Mage::getModel('giftvoucher/giftvoucher')->getCollection();
|
68 |
+
|
69 |
+
$giftVouchers = $collection->addItemFilter($item->getId());
|
70 |
+
|
71 |
+
|
72 |
+
|
73 |
+
if ($giftVouchers->getSize()){
|
74 |
+
$giftVouchersCode = array();
|
75 |
+
foreach ($giftVouchers as $giftVoucher){
|
76 |
+
$currency = Mage::getModel('directory/currency')->load($giftVoucher->getCurrency());
|
77 |
+
$balance = $giftVoucher->getBalance();
|
78 |
+
if ($currency) $balance = $currency->format($balance,array(),false);
|
79 |
+
$giftVouchersCode[] = $giftVoucher->getGiftCode().' ('.$balance.') ';
|
80 |
+
}
|
81 |
+
$codes = implode(' ',$giftVouchersCode);
|
82 |
+
$result[] = array(
|
83 |
+
'label' => $this->__('Gift Card Code'),
|
84 |
+
'value' => $codes,
|
85 |
+
'option_value' => $codes,
|
86 |
+
);
|
87 |
+
}
|
88 |
+
//error_log(print_r($result,TRUE));
|
89 |
+
return $result;
|
90 |
+
}
|
91 |
+
|
92 |
+
|
93 |
+
public function getVoucherCodesForItem($item) {
|
94 |
+
|
95 |
+
if ($options = $item->getProductOptionByCode('info_buyRequest'))
|
96 |
+
/*
|
97 |
+
foreach (Mage::helper('giftvoucher')->getGiftVoucherOptions() as $code=>$label)
|
98 |
+
if (array_key_exists($code,$options))
|
99 |
+
$result[] = array(
|
100 |
+
'label' => $label,
|
101 |
+
'value' => $options[$code],
|
102 |
+
'option_value' => $options[$code],
|
103 |
+
);
|
104 |
+
*/
|
105 |
+
$itemId = $item->getId();
|
106 |
+
if(!$itemId) {
|
107 |
+
$itemId = $item->_data['item_id'];
|
108 |
+
}
|
109 |
+
$collection = Mage::getModel('giftvoucher/giftvoucher')->getCollection();
|
110 |
+
$giftVouchers = $collection->addItemFilter($itemId);
|
111 |
+
if ($giftVouchers->getSize()){
|
112 |
+
$giftVouchersCode = array();
|
113 |
+
foreach ($giftVouchers as $giftVoucher){
|
114 |
+
$giftVouchersCode[] = $giftVoucher->getGiftCode();
|
115 |
+
}
|
116 |
+
}
|
117 |
+
//error_log(print_r($result,TRUE));
|
118 |
+
return $giftVouchersCode;
|
119 |
+
}
|
120 |
+
|
121 |
+
public function getSenderParamsForItem($item) {
|
122 |
+
|
123 |
+
$params = array();
|
124 |
+
|
125 |
+
|
126 |
+
$giftVouchers = Mage::getModel('giftvoucher/giftvoucher')->getCollection()->addItemFilter($item->getId());
|
127 |
+
if ($giftVouchers->getSize()){
|
128 |
+
foreach ($giftVouchers as $giftVoucher){
|
129 |
+
$params['from'] = $giftVoucher->getCustomerEmail();
|
130 |
+
$params['sender'] = $giftVoucher->getCustomerName();
|
131 |
+
|
132 |
+
$params['amount'] = $giftVoucher->getBalanceFormated();
|
133 |
+
$params['value'] = $giftVoucher->getBalance();
|
134 |
+
|
135 |
+
}
|
136 |
+
}
|
137 |
+
//error_log(print_r($result,TRUE));
|
138 |
+
return $params;
|
139 |
+
}
|
140 |
+
|
141 |
+
public function makeAuthorizeCallWithParams($params) {
|
142 |
+
|
143 |
+
$protocol = "https";
|
144 |
+
$host = "delightfully.com";
|
145 |
+
|
146 |
+
$method = "GET";
|
147 |
+
$authpath = "/api/partner/authorize";
|
148 |
+
|
149 |
+
|
150 |
+
$query = array();
|
151 |
+
|
152 |
+
|
153 |
+
foreach ($params as $param=>$value)
|
154 |
+
{
|
155 |
+
if($param != 'merchant') {
|
156 |
+
//replace tilde in case any urls require literal ~ to function despite RFC 1738
|
157 |
+
$param = str_replace('%7E', '~', rawurlencode($param));
|
158 |
+
$value = str_replace('%7E', '~', rawurlencode($value));
|
159 |
+
$query[] = $param.'='.$value;
|
160 |
+
}
|
161 |
+
}
|
162 |
+
$query = implode('&', $query);
|
163 |
+
$request = $protocol.'://'.$host.$authpath.'?'.$query;
|
164 |
+
$response = @file_get_contents($request);
|
165 |
+
//error_log(print_r($response,TRUE));
|
166 |
+
return $response;
|
167 |
+
}
|
168 |
+
|
169 |
+
|
170 |
+
public function makeWrapURL($params) {
|
171 |
+
|
172 |
+
$protocol = "https";
|
173 |
+
$host = "delightfully.com";
|
174 |
+
|
175 |
+
$wrappath = "/partner/wrap";
|
176 |
+
|
177 |
+
return $protocol.'://'.$host.$wrappath.'?merchant='.rawurlencode($params['merchant']).'&transaction='.rawurlencode($params['transaction']);
|
178 |
+
}
|
179 |
+
|
180 |
+
public function getBaseAPIParams() {
|
181 |
+
|
182 |
+
|
183 |
+
|
184 |
+
$authkey = Mage::getStoreConfig('delightfully_options/account/key');
|
185 |
+
$merchant = Mage::getStoreConfig('delightfully_options/account/merchant');
|
186 |
+
$redeem = Mage::getStoreConfig('delightfully_options/product/redeem_url');
|
187 |
+
|
188 |
+
//possible auto-generation of redeem url
|
189 |
+
//$redeem = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
190 |
+
|
191 |
+
if($redeem) {
|
192 |
+
$params['redeem'] = $redeem;
|
193 |
+
}
|
194 |
+
|
195 |
+
$params['key'] = $authkey;
|
196 |
+
$params['merchant'] = $merchant;
|
197 |
+
|
198 |
+
return $params;
|
199 |
+
}
|
200 |
+
}
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Delightfully_WrappedGiftCard_Helper_Giftvoucher_Data extends Magestore_Giftvoucher_Helper_Data {
|
3 |
+
|
4 |
+
//Get the list of labels we want to display data for
|
5 |
+
public function getGiftVoucherOptions() {
|
6 |
+
$optionLabels = parent::getGiftVoucherOptions();
|
7 |
+
$options1['send_friend'] = $this->__('Delivery Method');
|
8 |
+
|
9 |
+
return array_merge($options1,$optionLabels);
|
10 |
+
}
|
11 |
+
|
12 |
+
}
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Delightfully_WrappedGiftCard_Model_Giftvoucher extends Magestore_Giftvoucher_Model_Giftvoucher {
|
4 |
+
|
5 |
+
/*obnoxious lengths to get something that should have been saved in gifvoucher model to begin with*/
|
6 |
+
public function getDeliveryType() {
|
7 |
+
$giftCardId = $this->getId(); //may have not been created yet.
|
8 |
+
|
9 |
+
//get card history by giftvoucher_id
|
10 |
+
$history = Mage::getResourceModel('giftvoucher/history_collection')
|
11 |
+
->addFieldToFilter('giftvoucher_id', $giftCardId)
|
12 |
+
->addFieldToFilter('action', Magestore_Giftvoucher_Model_Actions::ACTIONS_CREATE)
|
13 |
+
->getFirstItem();
|
14 |
+
|
15 |
+
//get original order item from order_item_id in history entry
|
16 |
+
$orderItem = Mage::getModel('sales/order_item')->load($history->getOrderItemId());
|
17 |
+
|
18 |
+
if (!$history->getOrderIncrementId() || !$history->getOrderItemId()) {
|
19 |
+
//error_log("Failed to find delivery type from history");
|
20 |
+
return -1;
|
21 |
+
|
22 |
+
}
|
23 |
+
$requestInfo = $orderItem->getProductOptionByCode('info_buyRequest');
|
24 |
+
//error_log("Delivery type: " . print_r($requestInfo['send_friend'],TRUE));
|
25 |
+
return $requestInfo['send_friend'];
|
26 |
+
}
|
27 |
+
|
28 |
+
|
29 |
+
public function sendEmailToRecipient() {
|
30 |
+
$dtype = $this->getDeliveryType();
|
31 |
+
if($dtype < 2) {
|
32 |
+
return parent::sendEmailToRecipient();
|
33 |
+
} else {
|
34 |
+
//error_log('skipping recipient email for send_friend: '.$dtype);
|
35 |
+
return 1;
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
public function sendEmail(){
|
40 |
+
|
41 |
+
$dtype = $this->getDeliveryType();
|
42 |
+
|
43 |
+
//Mage::log($dtype,null,'dly.log');
|
44 |
+
|
45 |
+
if($dtype < 2) {
|
46 |
+
return parent::sendEmail();
|
47 |
+
} else {
|
48 |
+
//dummy send
|
49 |
+
/*
|
50 |
+
$store = Mage::app()->getStore($this->getStoreId());
|
51 |
+
$translate = Mage::getSingleton('core/translate');
|
52 |
+
$translate->setTranslateInline(false);
|
53 |
+
$mailSent = 0;
|
54 |
+
|
55 |
+
if ($this->getRecipientEmail()){
|
56 |
+
*/
|
57 |
+
$mailSent += $this->sendEmailToRecipient();
|
58 |
+
/*
|
59 |
+
}
|
60 |
+
*/
|
61 |
+
$this->setEmailSent($mailSent);
|
62 |
+
//$translate->setTranslateInline(true);
|
63 |
+
return $this;
|
64 |
+
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
68 |
+
}
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Delightfully_WrappedGiftCard_Model_Giftvoucher_Observer extends Magestore_Giftvoucher_Model_Observer
|
4 |
+
|
5 |
+
{
|
6 |
+
public function orderPlaceBefore($observer) {
|
7 |
+
parent::orderPlaceBefore($observer);
|
8 |
+
$order = $observer->getEvent()->getOrder();
|
9 |
+
//gift vouchers need order items to have been saved before giftvoucher is created in order placement. Multishipping needs this extra save.
|
10 |
+
$order->save();
|
11 |
+
}
|
12 |
+
|
13 |
+
public function orderPlaceAfter($observer) {
|
14 |
+
|
15 |
+
parent::orderPlaceAfter($observer);
|
16 |
+
|
17 |
+
$order = $observer->getEvent ()->getOrder ();
|
18 |
+
|
19 |
+
$orderIncrementId = $order->getIncrementId();
|
20 |
+
//get card history entries for this order
|
21 |
+
$giftHistories = Mage::getResourceModel('giftvoucher/history_collection')
|
22 |
+
->addFieldToFilter('order_increment_id', $orderIncrementId);
|
23 |
+
|
24 |
+
foreach ( $giftHistories as $gift ) {
|
25 |
+
$voucherId = $gift->getGiftvoucherId();
|
26 |
+
|
27 |
+
$orderItem = Mage::getModel('sales/order_item')->load($gift->getOrderItemId());
|
28 |
+
|
29 |
+
$buyRequest = $orderItem->getProductOptionByCode('info_buyRequest');
|
30 |
+
|
31 |
+
$giftVoucher = Mage::getModel('giftvoucher/giftvoucher')->load($voucherId);
|
32 |
+
|
33 |
+
$methodText = "";
|
34 |
+
$method = $buyRequest ['send_friend']; {
|
35 |
+
if($method == 2) {
|
36 |
+
$methodText = "Via Delightfully";
|
37 |
+
} else if ($method == 1) {
|
38 |
+
$methodText = "To friend via email";
|
39 |
+
} else {
|
40 |
+
$methodText = "Send to self";
|
41 |
+
}
|
42 |
+
}
|
43 |
+
$oldComments = $giftVoucher->getData('giftvoucher_comments');
|
44 |
+
if($oldComments) {
|
45 |
+
$methodText = $oldComments."\n".$methodText;
|
46 |
+
}
|
47 |
+
$giftVoucher->setData ( 'giftvoucher_comments', $methodText )->save ();
|
48 |
+
|
49 |
+
$gift->setData('comments', $methodText)->save();
|
50 |
+
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
}
|
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Delightfully_WrappedGiftCard_Model_Giftvoucher_Price extends Magestore_Giftvoucher_Model_Product_Price
|
3 |
+
{
|
4 |
+
/*
|
5 |
+
protected function _applyOptionsPrice($product, $qty, $finalPrice){
|
6 |
+
$finalPriceOut = $finalPrice;
|
7 |
+
try {
|
8 |
+
$finalPriceOut = parent::_applyOptionsPrice($product,$qty,$finalPrice);
|
9 |
+
} catch (Exception $e) {
|
10 |
+
Mage::log('Unable to get parent options price.', null, 'dly.log');
|
11 |
+
Mage::logException($e);
|
12 |
+
Mage::log(array_walk(debug_backtrace(),create_function('$a,$b','print "{$a[\'function\']}()(".basename($a[\'file\']).":{$a[\'line\']}); ";')), null, 'dly.log');
|
13 |
+
}
|
14 |
+
//apply fees (based on Delightfully-specific options)
|
15 |
+
$wrappingFee = -1;
|
16 |
+
|
17 |
+
try {
|
18 |
+
$wrappingFee = Mage::getStoreConfig('delightfully_options/product/wrap_price');
|
19 |
+
} catch (Exception $e) {
|
20 |
+
Mage::logException($e);
|
21 |
+
}
|
22 |
+
if(!$wrappingFee || $wrappingFee == -1) {
|
23 |
+
$wrappingFee = 0.0;
|
24 |
+
Mage::log('no wrapping fee setting found', null, 'dly.log');
|
25 |
+
Mage::log(array_walk(debug_backtrace(),create_function('$a,$b','print "{$a[\'function\']}()(".basename($a[\'file\']).":{$a[\'line\']}); ";')), null, 'dly.log');
|
26 |
+
}
|
27 |
+
$emailFee = 0.00;
|
28 |
+
$selfFee = 0.00;
|
29 |
+
|
30 |
+
$sendMethodOption = 0;
|
31 |
+
|
32 |
+
try {
|
33 |
+
$sendMethodOption = $product->getCustomOption('send_friend');
|
34 |
+
} catch (Exception $e) {
|
35 |
+
Mage::log('no delivery method found', null, 'dly.log');
|
36 |
+
Mage::logException($e);
|
37 |
+
Mage::log(array_walk(debug_backtrace(),create_function('$a,$b','print "{$a[\'function\']}()(".basename($a[\'file\']).":{$a[\'line\']}); ";')), null, 'dly.log');
|
38 |
+
}
|
39 |
+
|
40 |
+
if ($sendMethodOption){
|
41 |
+
$method = $sendMethodOption->getValue();
|
42 |
+
if($method == 2) {
|
43 |
+
$finalPriceOut = $finalPriceOut + $wrappingFee;
|
44 |
+
} else if($method == 1) {
|
45 |
+
$finalPriceOut = $finalPriceOut + $emailFee;
|
46 |
+
} else if($method == 0) {
|
47 |
+
$finalPriceOut = $finalPriceOut + $selfFee;
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
return $finalPriceOut;
|
52 |
+
}
|
53 |
+
}
|
54 |
+
*/
|
55 |
+
// get final price for catalog rule
|
56 |
+
public function getFinalPrice($qty=null, $product) {
|
57 |
+
|
58 |
+
$finalPriceOut = 0;
|
59 |
+
try {
|
60 |
+
$finalPriceOut = parent::getFinalPrice($qty, $product);
|
61 |
+
} catch (Exception $e) {
|
62 |
+
//Mage::log('Unable to get parent options price.', null, 'dly.log');
|
63 |
+
//Mage::logException($e);
|
64 |
+
//Mage::log(array_walk(debug_backtrace(),create_function('$a,$b','print "{$a[\'function\']}()(".basename($a[\'file\']).":{$a[\'line\']}); ";')), null, 'dly.log');
|
65 |
+
}
|
66 |
+
//apply fees (based on Delightfully-specific options)
|
67 |
+
$wrappingFee = -1;
|
68 |
+
|
69 |
+
try {
|
70 |
+
$wrappingFee = Mage::getStoreConfig('delightfully_options/product/wrap_price');
|
71 |
+
} catch (Exception $e) {
|
72 |
+
//Mage::logException($e);
|
73 |
+
}
|
74 |
+
if(!$wrappingFee || $wrappingFee == -1) {
|
75 |
+
$wrappingFee = 0.0;
|
76 |
+
//Mage::log('no wrapping fee setting found', null, 'dly.log');
|
77 |
+
//Mage::log(array_walk(debug_backtrace(),create_function('$a,$b','print "{$a[\'function\']}()(".basename($a[\'file\']).":{$a[\'line\']}); ";')), null, 'dly.log');
|
78 |
+
}
|
79 |
+
$emailFee = 0.00;
|
80 |
+
$selfFee = 0.00;
|
81 |
+
|
82 |
+
$sendMethodOption = 0;
|
83 |
+
|
84 |
+
try {
|
85 |
+
$sendMethodOption = $product->getCustomOption('send_friend');
|
86 |
+
} catch (Exception $e) {
|
87 |
+
//Mage::log('no delivery method found', null, 'dly.log');
|
88 |
+
//Mage::logException($e);
|
89 |
+
//Mage::log(array_walk(debug_backtrace(),create_function('$a,$b','print "{$a[\'function\']}()(".basename($a[\'file\']).":{$a[\'line\']}); ";')), null, 'dly.log');
|
90 |
+
}
|
91 |
+
|
92 |
+
if ($sendMethodOption){
|
93 |
+
$method = $sendMethodOption->getValue();
|
94 |
+
if($method == 2) {
|
95 |
+
$finalPriceOut = $finalPriceOut + $wrappingFee;
|
96 |
+
} else if($method == 1) {
|
97 |
+
$finalPriceOut = $finalPriceOut + $emailFee;
|
98 |
+
} else if($method == 0) {
|
99 |
+
$finalPriceOut = $finalPriceOut + $selfFee;
|
100 |
+
}
|
101 |
+
}
|
102 |
+
|
103 |
+
return $finalPriceOut;
|
104 |
+
}
|
105 |
+
}
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* This stub prevents email from being sent to recipients of a gift card that has an SKU containing DLYGC.
|
5 |
+
* Attempt a future-proof against later core changes -- overwrite all emails with $replace_email before call to generateGiftCardAccounts
|
6 |
+
* and replace emails after.
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Delightfully_WrappedGiftCard_Model_Observer extends Enterprise_GiftCard_Model_Observer
|
10 |
+
|
11 |
+
{
|
12 |
+
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Generate gift card accounts after order save
|
16 |
+
*
|
17 |
+
* @param Varien_Event_Observer $observer
|
18 |
+
* @return Enterprise_GiftCard_Model_Observer
|
19 |
+
*/
|
20 |
+
public function generateGiftCardAccounts(Varien_Event_Observer $observer)
|
21 |
+
{
|
22 |
+
|
23 |
+
$replace_email = "concierge@delightfully.com";
|
24 |
+
|
25 |
+
//change the destination email before we run code that sends giftcard email
|
26 |
+
$emails = array();
|
27 |
+
|
28 |
+
$order = $observer->getEvent()->getOrder();
|
29 |
+
$requiredStatus = Mage::getStoreConfig(Enterprise_GiftCard_Model_Giftcard::XML_PATH_ORDER_ITEM_STATUS, $order->getStore());
|
30 |
+
|
31 |
+
foreach ($order->getAllItems() as $item) {
|
32 |
+
if ($item->getProductType() == Enterprise_GiftCard_Model_Catalog_Product_Type_Giftcard::TYPE_GIFTCARD) {
|
33 |
+
if(preg_match('/DLYGC/',$item->getSku())) {
|
34 |
+
Mage::log("Modifying email address for gift card notification");
|
35 |
+
|
36 |
+
$options = $item->getProductOptions();
|
37 |
+
|
38 |
+
array_unshift($emails,$options['giftcard_recipient_email']);
|
39 |
+
|
40 |
+
$options['giftcard_recipient_email'] = $replace_email;
|
41 |
+
|
42 |
+
$item->setProductOptions($options);
|
43 |
+
|
44 |
+
}
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
|
49 |
+
//Now call the superclass to perform default giftcard creation
|
50 |
+
parent::generateGiftCardAccounts($observer);
|
51 |
+
|
52 |
+
|
53 |
+
|
54 |
+
//revert to user's intended email for later use
|
55 |
+
foreach ($order->getAllItems() as $item) {
|
56 |
+
if ($item->getProductType() == Enterprise_GiftCard_Model_Catalog_Product_Type_Giftcard::TYPE_GIFTCARD) {
|
57 |
+
if(preg_match('/DLYGC/',$item->getSku())) {
|
58 |
+
Mage::log("Restoring email addresses");
|
59 |
+
|
60 |
+
$options = $item->getProductOptions();
|
61 |
+
|
62 |
+
$options['giftcard_recipient_email'] = array_pop($emails);
|
63 |
+
|
64 |
+
$item->setProductOptions($options);
|
65 |
+
$item->save();
|
66 |
+
}
|
67 |
+
}
|
68 |
+
}
|
69 |
+
}
|
70 |
+
}
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Reserved for future use
|
4 |
+
*/
|
5 |
+
|
6 |
+
class Delightfully_WrappedGiftCard_Model_WrappedGiftCard
|
7 |
+
{
|
8 |
+
|
9 |
+
}
|
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Delightfully_WrappedGiftCard>
|
5 |
+
<version>0.1.2</version>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Delightfully_WrappedGiftCard>
|
8 |
+
</modules>
|
9 |
+
<global>
|
10 |
+
<helpers>
|
11 |
+
<delightfully_wrappedgiftcard>
|
12 |
+
<class>Delightfully_WrappedGiftCard_Helper</class>
|
13 |
+
</delightfully_wrappedgiftcard>
|
14 |
+
<giftvoucher>
|
15 |
+
<rewrite>
|
16 |
+
<data>Delightfully_WrappedGiftCard_Helper_Giftvoucher_Data</data>
|
17 |
+
</rewrite>
|
18 |
+
</giftvoucher>
|
19 |
+
</helpers>
|
20 |
+
<blocks>
|
21 |
+
<delightfully_wrappedgiftcard>
|
22 |
+
<class>Delightfully_WrappedGiftCard_Block</class>
|
23 |
+
</delightfully_wrappedgiftcard>
|
24 |
+
<catalog>
|
25 |
+
<giftvoucher>
|
26 |
+
<rewrite>
|
27 |
+
<product_view>Delightfully_WrappedGiftCard_Block_Product_View</product_view>
|
28 |
+
</rewrite>
|
29 |
+
</giftvoucher>
|
30 |
+
</catalog>
|
31 |
+
<cart>
|
32 |
+
<giftvoucher>
|
33 |
+
<rewrite>
|
34 |
+
<item>Delightfully_WrappedGiftCard_Block_Cart_Item</item>
|
35 |
+
</rewrite>
|
36 |
+
</giftvoucher>
|
37 |
+
</cart>
|
38 |
+
<!--
|
39 |
+
<adminhtml>
|
40 |
+
<rewrite>
|
41 |
+
<giftvoucher_grid>Delightfully_WrappedGiftCard_Block_Adminhtml_Giftvoucher_Grid</giftvoucher_grid>
|
42 |
+
<giftvoucher>Delightfully_WrappedGiftCard_Block_Adminhtml_Giftvoucher</giftvoucher>
|
43 |
+
</rewrite>
|
44 |
+
</adminhtml>
|
45 |
+
-->
|
46 |
+
</blocks>
|
47 |
+
<models>
|
48 |
+
<delightfully_wrappedgiftcard>
|
49 |
+
<class>Delightfully_WrappedGiftCard_Model</class>
|
50 |
+
</delightfully_wrappedgiftcard>
|
51 |
+
<enterprise_giftcard>
|
52 |
+
<rewrite>
|
53 |
+
<observer>Delightfully_WrappedGiftCard_Model_Observer</observer>
|
54 |
+
</rewrite>
|
55 |
+
</enterprise_giftcard>
|
56 |
+
<giftvoucher>
|
57 |
+
<rewrite>
|
58 |
+
<giftvoucher>Delightfully_WrappedGiftCard_Model_Giftvoucher</giftvoucher>
|
59 |
+
<observer>Delightfully_WrappedGiftCard_Model_Giftvoucher_Observer</observer>
|
60 |
+
<!--<product_price>Delightfully_WrappedGiftCard_Model_Giftvoucher_Price</product_price> -->
|
61 |
+
</rewrite>
|
62 |
+
</giftvoucher>
|
63 |
+
</models>
|
64 |
+
<catalog>
|
65 |
+
<product>
|
66 |
+
<type>
|
67 |
+
|
68 |
+
<giftvoucher translate="label" module="giftvoucher">
|
69 |
+
<label>Gift Card</label>
|
70 |
+
<model>giftvoucher/product_type</model>
|
71 |
+
<price_model>delightfully_wrappedgiftcard/giftvoucher_price</price_model>
|
72 |
+
<index_data_retreiver>catalogindex/data_simple</index_data_retreiver>
|
73 |
+
<is_qty>1</is_qty>
|
74 |
+
</giftvoucher>
|
75 |
+
|
76 |
+
</type>
|
77 |
+
</product>
|
78 |
+
</catalog>
|
79 |
+
</global>
|
80 |
+
<default>
|
81 |
+
<delightfully_options>
|
82 |
+
<account>
|
83 |
+
<merchant>testing</merchant>
|
84 |
+
<key>Y9Y7ZXjaYagP5CpM</key>
|
85 |
+
</account>
|
86 |
+
<product>
|
87 |
+
<wrap_price>0.00</wrap_price>
|
88 |
+
<gift_description>gift credit.</gift_description>
|
89 |
+
</product>
|
90 |
+
</delightfully_options>
|
91 |
+
</default>
|
92 |
+
<frontend>
|
93 |
+
<layout>
|
94 |
+
<updates>
|
95 |
+
<wrappedgiftcard>
|
96 |
+
<file>delightfully/wrappedgiftcard.xml</file>
|
97 |
+
</wrappedgiftcard>
|
98 |
+
</updates>
|
99 |
+
</layout>
|
100 |
+
</frontend>
|
101 |
+
<adminhtml>
|
102 |
+
<layout>
|
103 |
+
|
104 |
+
<updates>
|
105 |
+
<wrappedgiftcard>
|
106 |
+
<file>delightfully/wrappedgiftcard.xml</file>
|
107 |
+
</wrappedgiftcard>
|
108 |
+
</updates>
|
109 |
+
</layout>
|
110 |
+
<acl>
|
111 |
+
<resources>
|
112 |
+
<admin>
|
113 |
+
<children>
|
114 |
+
<system>
|
115 |
+
<children>
|
116 |
+
<config>
|
117 |
+
<children>
|
118 |
+
<delightfully_options>
|
119 |
+
<title>Delightfully Module Section</title>
|
120 |
+
</delightfully_options>
|
121 |
+
</children>
|
122 |
+
</config>
|
123 |
+
</children>
|
124 |
+
</system>
|
125 |
+
</children>
|
126 |
+
</admin>
|
127 |
+
</resources>
|
128 |
+
</acl>
|
129 |
+
</adminhtml>
|
130 |
+
</config>
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<config>
|
2 |
+
<tabs>
|
3 |
+
<delightfullyconfig translate="label" module="delightfully_wrappedgiftcard">
|
4 |
+
<label>Delightfully</label>
|
5 |
+
<sort_order>99999</sort_order>
|
6 |
+
</delightfullyconfig>
|
7 |
+
</tabs>
|
8 |
+
<sections>
|
9 |
+
<delightfully_options translate="label" module="delightfully_wrappedgiftcard">
|
10 |
+
<label>Delightfully Configuration</label>
|
11 |
+
<tab>delightfullyconfig</tab>
|
12 |
+
<frontend_type>text</frontend_type>
|
13 |
+
<sort_order>1000</sort_order>
|
14 |
+
<show_in_default>1</show_in_default>
|
15 |
+
<show_in_website>1</show_in_website>
|
16 |
+
<show_in_store>1</show_in_store>
|
17 |
+
<groups>
|
18 |
+
<account translate="label">
|
19 |
+
<label>Delightfully Account</label>
|
20 |
+
<frontend_type>text</frontend_type>
|
21 |
+
<sort_order>1</sort_order>
|
22 |
+
<show_in_default>1</show_in_default>
|
23 |
+
<show_in_website>1</show_in_website>
|
24 |
+
<show_in_store>1</show_in_store>
|
25 |
+
<fields>
|
26 |
+
<merchant>
|
27 |
+
<label>Your Delightfully username</label>
|
28 |
+
<frontend_type>text</frontend_type>
|
29 |
+
<sort_order>1</sort_order>
|
30 |
+
<show_in_default>1</show_in_default>
|
31 |
+
<show_in_website>1</show_in_website>
|
32 |
+
<show_in_store>1</show_in_store>
|
33 |
+
</merchant>
|
34 |
+
<key>
|
35 |
+
<label>Your Delightfully API key</label>
|
36 |
+
<frontend_type>text</frontend_type>
|
37 |
+
<sort_order>2</sort_order>
|
38 |
+
<show_in_default>1</show_in_default>
|
39 |
+
<show_in_website>1</show_in_website>
|
40 |
+
<show_in_store>1</show_in_store>
|
41 |
+
</key>
|
42 |
+
</fields>
|
43 |
+
|
44 |
+
</account>
|
45 |
+
<product translate="label">
|
46 |
+
<label>Product Configuration</label>
|
47 |
+
<frontend_type>text</frontend_type>
|
48 |
+
<sort_order>2</sort_order>
|
49 |
+
<show_in_default>1</show_in_default>
|
50 |
+
<show_in_website>1</show_in_website>
|
51 |
+
<show_in_store>1</show_in_store>
|
52 |
+
<fields>
|
53 |
+
<wrap_price>
|
54 |
+
<label>Price for Delightfully Wrapping</label>
|
55 |
+
<frontend_type>text</frontend_type>
|
56 |
+
<sort_order>1</sort_order>
|
57 |
+
<show_in_default>1</show_in_default>
|
58 |
+
<show_in_website>1</show_in_website>
|
59 |
+
<show_in_store>1</show_in_store>
|
60 |
+
</wrap_price>
|
61 |
+
<redeem_url>
|
62 |
+
<label>URL to provide to gift recipient for gift redemption (optional)</label>
|
63 |
+
<frontend_type>text</frontend_type>
|
64 |
+
<sort_order>1</sort_order>
|
65 |
+
<show_in_default>1</show_in_default>
|
66 |
+
<show_in_website>1</show_in_website>
|
67 |
+
<show_in_store>1</show_in_store>
|
68 |
+
</redeem_url>
|
69 |
+
<gift_description>
|
70 |
+
<label>Description of gift credit. Gift ammount will be prepended to this string (for example, ``gift credit for Mystore.com.`` will appear as ``$50.00 gift credit for Mystore.com.``</label>
|
71 |
+
<frontend_type>text</frontend_type>
|
72 |
+
<sort_order>1</sort_order>
|
73 |
+
<show_in_default>1</show_in_default>
|
74 |
+
<show_in_website>1</show_in_website>
|
75 |
+
<show_in_store>1</show_in_store>
|
76 |
+
</gift_description>
|
77 |
+
</fields>
|
78 |
+
</product>
|
79 |
+
|
80 |
+
</groups>
|
81 |
+
</delightfully_options>
|
82 |
+
</sections>
|
83 |
+
</config>
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<giftvoucheradmin_adminhtml_giftvoucher_index>
|
4 |
+
<reference name="content">
|
5 |
+
<action method="unsetChild">
|
6 |
+
<name>giftvoucher</name>
|
7 |
+
</action>
|
8 |
+
<block type="delightfully_wrappedgiftcard/adminhtml_giftvoucher" name="giftvoucher" />
|
9 |
+
</reference>
|
10 |
+
</giftvoucheradmin_adminhtml_giftvoucher_index>
|
11 |
+
</layout>
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.2">
|
3 |
+
<checkout_onepage_success>
|
4 |
+
<remove name="checkout.success"/>
|
5 |
+
<reference name="head">
|
6 |
+
<action method="addCss">
|
7 |
+
<stylesheet>delightfully/wrappedgiftcard/css/wrappedgiftcard.css</stylesheet>
|
8 |
+
</action>
|
9 |
+
</reference>
|
10 |
+
<reference name="content">
|
11 |
+
<block name="delightfully.wrappedgiftcard" template="delightfully/wrappedgiftcard/wrappedgiftcard.phtml" type="delightfully_wrappedgiftcard/wrappedgiftcard"/>
|
12 |
+
</reference>
|
13 |
+
</checkout_onepage_success>
|
14 |
+
<checkout_multishipping_success>
|
15 |
+
<remove name="checkout_success"/>
|
16 |
+
<reference name="head">
|
17 |
+
<action method="addCss">
|
18 |
+
<stylesheet>delightfully/wrappedgiftcard/css/wrappedgiftcard.css</stylesheet>
|
19 |
+
</action>
|
20 |
+
</reference>
|
21 |
+
<reference name="content">
|
22 |
+
<block name="delightfully.wrappedgiftcard" template="delightfully/wrappedgiftcard/multishipping/wrappedgiftcard.phtml" type="delightfully_wrappedgiftcard/multishipping_wrappedgiftcard"/>
|
23 |
+
</reference>
|
24 |
+
</checkout_multishipping_success>
|
25 |
+
<PRODUCT_TYPE_giftvoucher translate="label">
|
26 |
+
<label>Catalog Product View (Gift Card)</label>
|
27 |
+
<reference name="product.info">
|
28 |
+
<block as="product_type_data" name="product.info.giftvoucher" template="delightfully/wrappedgiftcard/product/view.phtml" type="delightfully_wrappedgiftcard/product_view"/>
|
29 |
+
</reference>
|
30 |
+
</PRODUCT_TYPE_giftvoucher>
|
31 |
+
<checkout_cart_index>
|
32 |
+
<reference name="checkout.cart">
|
33 |
+
<action method="addItemRender">
|
34 |
+
<type>giftvoucher</type>
|
35 |
+
<block>delightfully_wrappedgiftcard/cart_item</block>
|
36 |
+
<template>checkout/cart/item/default.phtml</template>
|
37 |
+
</action>
|
38 |
+
</reference>
|
39 |
+
</checkout_cart_index>
|
40 |
+
<checkout_onepage_review>
|
41 |
+
<reference name="root">
|
42 |
+
<action method="addItemRender">
|
43 |
+
<type>giftvoucher</type>
|
44 |
+
<block>delightfully_wrappedgiftcard/cart_item</block>
|
45 |
+
<template>checkout/onepage/review/item.phtml</template>
|
46 |
+
</action>
|
47 |
+
</reference>
|
48 |
+
</checkout_onepage_review>
|
49 |
+
</layout>
|
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* Portions of this source file are subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with Magento Community Edition in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php $totalWrapped = 0;?>
|
28 |
+
|
29 |
+
<div class="multiple-checkout">
|
30 |
+
<div class="page-title">
|
31 |
+
<h1><?php echo $this->__('Order Success') ?></h1>
|
32 |
+
</div>
|
33 |
+
<h2 class="sub-title"><?php echo $this->__('Thank you for your purchase!') ?></h2>
|
34 |
+
<script>
|
35 |
+
var _gaq = _gaq || [];
|
36 |
+
_gaq.push(["_setAccount", "UA-43140719-1"]);
|
37 |
+
_gaq.push(["_trackPageview"]);
|
38 |
+
</script>
|
39 |
+
<p><?php echo $this->__('We are processing your order and you will soon receive an email with details of the order. Once the order has shipped you will receive another email with a link to track its progress.') ?></p>
|
40 |
+
<?php if(!($_orderIds = $this->getOrderIds(true))) {/*?>NO ORDER FOUND. USING DEFAULT.<?php $_orderIds['864'] = '100050793';*/}?>
|
41 |
+
<?php if($_orderIds): ?>
|
42 |
+
<p>
|
43 |
+
<?php $flag = false ?>
|
44 |
+
<?php echo $this->__('Your order number is ') ?>
|
45 |
+
<?php foreach ($_orderIds as $orderId=>$incrementId): ?>
|
46 |
+
<?php if ($flag): ?>
|
47 |
+
<?php echo ', ' ?>
|
48 |
+
<?php endif; ?>
|
49 |
+
<?php $flag = true ?>
|
50 |
+
<a href="<?php echo $this->getViewOrderUrl($orderId) ?>"><?php echo $incrementId ?></a>
|
51 |
+
|
52 |
+
<!-- -->
|
53 |
+
|
54 |
+
<?php
|
55 |
+
|
56 |
+
$order = $this->getOrderByIncrementId($incrementId);
|
57 |
+
$products = $order->getAllVisibleItems();
|
58 |
+
|
59 |
+
|
60 |
+
$prodCount = count($products);
|
61 |
+
$count=0;
|
62 |
+
$prescan=0;
|
63 |
+
$transaction = $incrementId;
|
64 |
+
|
65 |
+
$dhelper = Mage::helper('delightfully_wrappedgiftcard');
|
66 |
+
|
67 |
+
$prescan = $this->countWrappedCardsInOrderItems($products);
|
68 |
+
$totalWrapped = $totalWrapped + $prescan;
|
69 |
+
|
70 |
+
|
71 |
+
if($prescan > 0) {
|
72 |
+
echo '<div class="page-title"></div> <h2>This order includes personalized gift wrap. Continue here:<br>';
|
73 |
+
?><script>
|
74 |
+
var _gaq = _gaq || [];
|
75 |
+
_gaq.push(["_setAccount", "UA-43140719-1"]);
|
76 |
+
_gaq.push(["_trackEvent", 'GiftCardPurchased', 'ShowWrapButton', 'MultishipGiftVoucher']);
|
77 |
+
</script>
|
78 |
+
<?php
|
79 |
+
if($prescan > 1) {
|
80 |
+
echo 'Be sure to customize each of your gifts by returning to this window. We\'ll leave it open for you.<br>';
|
81 |
+
}
|
82 |
+
|
83 |
+
echo '</h2><br>';
|
84 |
+
foreach ( $products as $product ) {
|
85 |
+
$countThisItem = $this->countGiftCodes($product);
|
86 |
+
for($codeInItem=0;$codeInItem<$countThisItem;$codeInItem++) {
|
87 |
+
$params = $this->getAPIParamsForItem($product,$transaction,$count,$codeInItem);
|
88 |
+
if(count($params) > 0) {
|
89 |
+
$dhelper->makeAuthorizeCallWithParams($params);
|
90 |
+
|
91 |
+
$wrapurl = $dhelper->makeWrapURL($params);
|
92 |
+
|
93 |
+
if($prescan > 1) {
|
94 |
+
echo 'Your gift for ' . $params['recipient'];
|
95 |
+
if($countThisItem > 1) {
|
96 |
+
echo ' ('. ($codeInItem + 1) . ' of ' . $countThisItem . ')';
|
97 |
+
}
|
98 |
+
echo ': <br>';
|
99 |
+
}
|
100 |
+
|
101 |
+
echo '<button type="button" class="button" title="Wrap your gift" onclick="window.open(\'';
|
102 |
+
echo $wrapurl;
|
103 |
+
echo '\');_gaq = _gaq || [];_gaq.push([\'_setAccount\', \'UA-43140719-1\']);_gaq.push([\'_trackEvent\', \'GiftCardPurchased\', \'ClickWrapLink\', \'GiftVoucher\']);"><span><span>Continue to gift Wrap</span></span></button><br>';
|
104 |
+
|
105 |
+
if($prescan > 1) {
|
106 |
+
echo '<br><br>';
|
107 |
+
}
|
108 |
+
$count += 1;
|
109 |
+
|
110 |
+
}
|
111 |
+
}
|
112 |
+
}
|
113 |
+
}
|
114 |
+
?>
|
115 |
+
|
116 |
+
|
117 |
+
|
118 |
+
<!-- -->
|
119 |
+
<?php endforeach; ?>
|
120 |
+
</p>
|
121 |
+
<?php endif; ?>
|
122 |
+
<?php echo $this->getChildHtml() ?>
|
123 |
+
</div>
|
124 |
+
|
125 |
+
|
126 |
+
<?php if ($totalWrapped < 1):?>
|
127 |
+
<div class="buttons-set">
|
128 |
+
<button type="button" title="<?php echo $this->__('Continue Shopping') ?>" class="button" onclick="setLocation('<?php echo $this->getContinueUrl() ?>')"><span><span><?php echo $this->__('Continue Shopping') ?></span></span></button>
|
129 |
+
</div>
|
130 |
+
<?php endif?>
|
131 |
+
<?php
|
132 |
+
|
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Gift Voucher View Product template
|
4 |
+
*/
|
5 |
+
?>
|
6 |
+
<?php
|
7 |
+
$_product = $this->getProduct();
|
8 |
+
$_giftAmount = $this->getGiftAmount($_product);
|
9 |
+
$_formData = $this->getFormConfigData();
|
10 |
+
?>
|
11 |
+
|
12 |
+
<div class="giftvoucher-product-info">
|
13 |
+
<?php if ($_giftAmount['type'] == 'range'): ?>
|
14 |
+
<p></p><p>
|
15 |
+
<label for="amount"><?php echo $this->__('Enter Amount:') ?></label>
|
16 |
+
<input id="amount" name="amount" class="input-text required-entry validate-greater-than-zero" onchange="validateInputRange(this);" value="<?php echo $_formData->getAmount() ?>" />
|
17 |
+
(<span class="price"><?php echo $_giftAmount['from_txt'] ?></span> - <span class="price"><?php echo $_giftAmount['to_txt'] ?></span>)
|
18 |
+
<script type="text/javascript">
|
19 |
+
//<![CDATA[
|
20 |
+
function validateInputRange(el){
|
21 |
+
var gift_amount_min = <?php echo $_giftAmount['from'] ?>;
|
22 |
+
var gift_amount_max = <?php echo $_giftAmount['to'] ?>;
|
23 |
+
if (el.value < gift_amount_min)
|
24 |
+
el.value = gift_amount_min;
|
25 |
+
if (el.value > gift_amount_max)
|
26 |
+
el.value = gift_amount_max;
|
27 |
+
|
28 |
+
_gaq = _gaq || [];
|
29 |
+
_gaq.push(['_setAccount', 'UA-43140719-1']);
|
30 |
+
_gaq.push(['_trackEvent', 'GiftCardBrowse', 'ChangeValue', 'GiftVoucher', Number(el.value)]);
|
31 |
+
}
|
32 |
+
|
33 |
+
//]]>
|
34 |
+
</script>
|
35 |
+
</p>
|
36 |
+
<?php elseif($_giftAmount['type'] == 'dropdown'): ?>
|
37 |
+
<p></p><p>
|
38 |
+
<label for="amount"><?php echo $this->__('Select Amount:') ?></label>
|
39 |
+
<select id="amount" name="amount" class="required-entry select">
|
40 |
+
<?php $options = array_combine($_giftAmount['options'],$_giftAmount['options_txt']) ?>
|
41 |
+
<?php foreach ($options as $value=>$label): ?>
|
42 |
+
<option value="<?php echo $value ?>" <?php if($value == $_formData->getAmount()) echo 'selected' ?> ><?php echo $label ?></option>
|
43 |
+
<?php endforeach ?>
|
44 |
+
</select>
|
45 |
+
</p>
|
46 |
+
<?php elseif($_giftAmount['type'] == 'static'): ?>
|
47 |
+
<div class="price-box">
|
48 |
+
<span class="regular-price">
|
49 |
+
<span class="price">
|
50 |
+
<?php echo $_giftAmount['value_txt'] ?>
|
51 |
+
<input type="hidden" name="amount" value="<?php echo $_giftAmount['value'] ?>" />
|
52 |
+
</span>
|
53 |
+
</span>
|
54 |
+
</div>
|
55 |
+
<?php elseif($_giftAmount['type'] == 'any'): ?>
|
56 |
+
<p></p><p>
|
57 |
+
<label for="amount"><?php echo $this->__('Enter Amount:') ?></label>
|
58 |
+
<input id="amount" name="amount" class="input-text required-entry validate-greater-than-zero" value="<?php echo $_formData->getAmount() ?>" />
|
59 |
+
</p>
|
60 |
+
<?php endif ?>
|
61 |
+
<?php if ($this->getGiftAmountDescription()): ?>
|
62 |
+
<p class="giftvoucher-amount-desc"><?php echo $this->getGiftAmountDescription() ?></p>
|
63 |
+
<?php endif ?>
|
64 |
+
<?php
|
65 |
+
$sendmethod = $_formData->getSendFriend();
|
66 |
+
$amountChosen = !is_null($_formData->getAmount());
|
67 |
+
|
68 |
+
|
69 |
+
?>
|
70 |
+
<p>
|
71 |
+
<input type="radio" value="2" name="send_friend" id="send_friend2" onclick="sendFriend(this);" <?php if ($sendmethod == 2 or !$amountChosen) echo 'checked' ?> />
|
72 |
+
<label for="send_friend"><?php echo $this->__('Send Gift Card to Friend using Virtual Gift Wrap') ?>
|
73 |
+
<?php
|
74 |
+
$wrappingFee = Mage::getStoreConfig('delightfully_options/product/wrap_price');
|
75 |
+
if($wrappingFee && $wrappingFee > 0) {
|
76 |
+
echo '(' . $this->__('add') . ' ' . $this->helper('checkout')->formatPrice($wrappingFee) . ')';
|
77 |
+
}
|
78 |
+
?>
|
79 |
+
|
80 |
+
</label>
|
81 |
+
<br>
|
82 |
+
<input type="radio" value="1" name="send_friend" id="send_friend1" onclick="sendFriend(this);" <?php if ($sendmethod == 1) echo 'checked' ?> />
|
83 |
+
<label for="send_friend"><?php echo $this->__('Send Gift Card to Friend By Email') ?></label>
|
84 |
+
<br>
|
85 |
+
<input type="radio" value="0" name="send_friend" id="send_friend0" onclick="sendFriend(this);" <?php if (!$sendmethod and $amountChosen) echo 'checked' ?> />
|
86 |
+
<label for="send_friend"><?php echo $this->__('Send Gift Card to Me') ?></label>
|
87 |
+
<br>
|
88 |
+
<script type="text/javascript">
|
89 |
+
//<![CDATA[
|
90 |
+
|
91 |
+
|
92 |
+
_gaq = _gaq || [];
|
93 |
+
_gaq.push(['_setAccount', 'UA-43140719-1']);
|
94 |
+
_gaq.push(['_trackPageview']);
|
95 |
+
|
96 |
+
function sendFriend(el){
|
97 |
+
var receiver = $('giftvoucher-receiver');
|
98 |
+
var giftmedia = $('giftmedia');
|
99 |
+
if (el.value > 0){
|
100 |
+
if (receiver) receiver.show();
|
101 |
+
if (giftmedia) giftmedia.show();
|
102 |
+
}else{
|
103 |
+
if (receiver) receiver.hide();
|
104 |
+
if (giftmedia) giftmedia.hide();
|
105 |
+
}
|
106 |
+
_gaq = _gaq || [];
|
107 |
+
_gaq.push(['_setAccount', 'UA-43140719-1']);
|
108 |
+
_gaq.push(['_trackEvent', 'GiftCardBrowse', 'ChangeDeliveryTo'+el.value, 'GiftVoucher']);
|
109 |
+
}
|
110 |
+
//]]>
|
111 |
+
</script>
|
112 |
+
</p>
|
113 |
+
<div class="giftvoucher-receiver" id="giftvoucher-receiver" style="<?php if (!$sendmethod and $amountChosen) echo 'display:none;' ?>">
|
114 |
+
<p>
|
115 |
+
<label for="recipient_name"><?php echo $this->__('Recipient Name:') ?></label><br />
|
116 |
+
<input type="text" class="input-text required-entry" name="recipient_name" id="recipient_name" value="<?php echo $_formData->getRecipientName() ?>" />
|
117 |
+
</p>
|
118 |
+
<p>
|
119 |
+
<label for="recipient_email"><?php echo $this->__('Recipient Email:') ?></label><br />
|
120 |
+
<input type="text" class="input-text required-entry validate-email" name="recipient_email" id="recipient_email" value="<?php echo $_formData->getRecipientEmail() ?>" />
|
121 |
+
</p>
|
122 |
+
<?php if ($this->enablePhysicalMail()): ?>
|
123 |
+
<p>
|
124 |
+
<input type="checkbox" value="<?php echo $this->__('Yes') ?>" name="recipient_ship" id="recipient_ship" onclick="shipToFriend(this);" <?php if($_formData->getRecipientShip()) echo 'checked' ?> />
|
125 |
+
<label for="recipient_ship"><?php echo $this->__('Send through post office') ?></label>
|
126 |
+
<p id="recipient_ship_desc"><?php echo $this->__("You need to add your friend's address as the shipping address in Checkout page. We will send this gift card to that address.") ?></p>
|
127 |
+
<p id="postal_address" style="display:none;">
|
128 |
+
<label for="recipient_address"><?php echo $this->__('Postal Address:') ?></label><br />
|
129 |
+
<textarea name="recipient_address" id="recipient_address"></textarea>
|
130 |
+
</p>
|
131 |
+
<script type="text/javascript">
|
132 |
+
//<![CDATA[
|
133 |
+
function shipToFriend(el){
|
134 |
+
if (el.checked) {
|
135 |
+
$('recipient_ship_desc').show();
|
136 |
+
// $('postal_address').show();
|
137 |
+
} else {
|
138 |
+
$('recipient_ship_desc').hide();
|
139 |
+
// $('postal_address').hide();
|
140 |
+
}
|
141 |
+
}
|
142 |
+
shipToFriend($('recipient_ship'));
|
143 |
+
//]]>
|
144 |
+
</script>
|
145 |
+
</p>
|
146 |
+
<?php endif ?>
|
147 |
+
<?php if ($this->enableCustomMessage()): ?>
|
148 |
+
<p>
|
149 |
+
<label for="message"><?php echo $this->__('Custom message') ?></label><br />
|
150 |
+
<textarea name="message" id="message" class="required-entry" onchange="changeRemaining(this);" onkeyup="changeRemaining(this);"><?php echo $_formData->getMessage() ?></textarea><br />
|
151 |
+
<small><?php echo $this->__('Characters Remaining: ') ?><span id="giftvoucher_char_remaining"><?php echo $this->messageMaxLen() ?></span></small>
|
152 |
+
<script type="text/javascript">
|
153 |
+
//<![CDATA[
|
154 |
+
var remaining_max = <?php echo $this->messageMaxLen() ?>;
|
155 |
+
function changeRemaining(el){
|
156 |
+
if (el.value.length > remaining_max){
|
157 |
+
el.value = el.value.substring(0,remaining_max);
|
158 |
+
}
|
159 |
+
$('giftvoucher_char_remaining').innerHTML = remaining_max - el.value.length;
|
160 |
+
var giftmedia = $('giftmedia-pre');
|
161 |
+
if (giftmedia)
|
162 |
+
giftmedia.innerHTML = el.value;
|
163 |
+
}
|
164 |
+
//]]>
|
165 |
+
</script>
|
166 |
+
</p>
|
167 |
+
<?php endif ?>
|
168 |
+
<?php if ($this->enableScheduleSend()): ?>
|
169 |
+
<?php echo $this->getLayout()->createBlock('core/html_calendar')->setTemplate('page/js/calendar.phtml')->toHtml() ?>
|
170 |
+
<p>
|
171 |
+
<label for="day_to_send"><?php echo $this->__('Day To Send:') ?></label><br />
|
172 |
+
<input type="text" class="input-text" name="day_to_send" id="day_to_send" value="<?php echo $_formData->getDayToSend() ?>" />
|
173 |
+
<img src="<?php echo Mage::getBaseUrl('skin')?>/adminhtml/default/default/images/grid-cal.gif" alt="<?php echo $this->__('Select Date') ?>" class="v-middle" id="calendar-day_to_send" />
|
174 |
+
</p>
|
175 |
+
<script type="text/javascript">
|
176 |
+
Calendar.setup({
|
177 |
+
inputField: "day_to_send",
|
178 |
+
ifFormat: "%m/%e/%y",
|
179 |
+
showsTime: false,
|
180 |
+
button: "calendar-day_to_send",
|
181 |
+
align: "Bl",
|
182 |
+
singleClick : true
|
183 |
+
});
|
184 |
+
</script>
|
185 |
+
<?php endif ?>
|
186 |
+
</div>
|
187 |
+
<p></p>
|
188 |
+
</div>
|
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* Portions of this source file are subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with Magento Community Edition in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
|
28 |
+
<div class="page-title">
|
29 |
+
<h1><?php echo $this->__('Your order has been received.') ?></h1>
|
30 |
+
</div>
|
31 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
32 |
+
<h2 class="sub-title"><?php echo $this->__('Thank you for your purchase!') ?></h2>
|
33 |
+
|
34 |
+
<script>
|
35 |
+
var _gaq = _gaq || [];
|
36 |
+
_gaq.push(["_setAccount", "UA-43140719-1"]);
|
37 |
+
_gaq.push(["_trackPageview"]);
|
38 |
+
</script>
|
39 |
+
|
40 |
+
<?php if ($this->getOrderId()):?>
|
41 |
+
<?php if ($this->getCanViewOrder()) :?>
|
42 |
+
<p><?php echo $this->__('Your order # is: %s.', sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getViewOrderUrl()), $this->escapeHtml($this->getOrderId()))) ?></p>
|
43 |
+
<?php else :?>
|
44 |
+
<p><?php echo $this->__('Your order # is: %s.', $this->escapeHtml($this->getOrderId())) ?></p>
|
45 |
+
<?php endif;?>
|
46 |
+
<p><?php echo $this->__('You will receive an order confirmation email with details of your order and a link to track its progress.') ?></p>
|
47 |
+
<?php if ($this->getCanViewOrder() && $this->getCanPrintOrder()) :?>
|
48 |
+
<p>
|
49 |
+
<?php echo $this->__('Click <a href="%s" onclick="this.target=\'_blank\'">here to print</a> a copy of your order confirmation.', $this->getPrintUrl()) ?>
|
50 |
+
<?php echo $this->getChildHtml() ?>
|
51 |
+
</p>
|
52 |
+
<?php endif;?>
|
53 |
+
<?php endif;?>
|
54 |
+
|
55 |
+
<?php if ($this->getAgreementRefId()): ?>
|
56 |
+
<p><?php echo $this->__('Your billing agreement # is: %s.', sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getAgreementUrl()), $this->escapeHtml($this->getAgreementRefId())))?></p>
|
57 |
+
<?php endif;?>
|
58 |
+
|
59 |
+
<?php if ($profiles = $this->getRecurringProfiles()):?>
|
60 |
+
<p><?php echo $this->__('Your recurring payment profiles:'); ?></p>
|
61 |
+
<ul class="disc">
|
62 |
+
<?php foreach($profiles as $profile):?>
|
63 |
+
<?php $profileIdHtml = ($this->getCanViewProfiles() ? sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getProfileUrl($profile)), $this->escapeHtml($this->getObjectData($profile, 'reference_id'))) : $this->escapeHtml($this->getObjectData($profile, 'reference_id')));?>
|
64 |
+
<li><?php echo $this->__('Payment profile # %s: "%s".', $profileIdHtml, $this->escapeHtml($this->getObjectData($profile, 'schedule_description')))?></li>
|
65 |
+
<?php endforeach;?>
|
66 |
+
</ul>
|
67 |
+
<?php endif;?>
|
68 |
+
|
69 |
+
|
70 |
+
<?php
|
71 |
+
|
72 |
+
$order = $this->getOrder();
|
73 |
+
$products = $order->getAllVisibleItems();
|
74 |
+
$prodCount = count($products);
|
75 |
+
$count=0;
|
76 |
+
$prescan=0;
|
77 |
+
$transaction = $this->getOrderId();
|
78 |
+
?>
|
79 |
+
<?php
|
80 |
+
|
81 |
+
$dhelper = Mage::helper('delightfully_wrappedgiftcard');
|
82 |
+
|
83 |
+
$prescan = $this->countWrappedCardsInOrderItems($products);
|
84 |
+
|
85 |
+
if($prescan > 0) {
|
86 |
+
echo '<div class="page-title"></div> <h2>Your purchase includes personalized gift wrap. Continue here:<br>';
|
87 |
+
} else {
|
88 |
+
?><div class="buttons-set">
|
89 |
+
<button type="button" class="button" title="<?php echo $this->__('Continue Shopping') ?>" onclick="window.location='<?php echo $this->getUrl() ?>'"><span><span><?php echo $this->__('Continue Shopping') ?></span></span></button>
|
90 |
+
</div><?php
|
91 |
+
}
|
92 |
+
if($prescan > 1) {
|
93 |
+
echo 'Be sure to customize each of your gifts by returning to this window. We\'ll leave it open for you.<br>';
|
94 |
+
}
|
95 |
+
|
96 |
+
echo '</h2><br>';
|
97 |
+
foreach ( $products as $product ) {
|
98 |
+
$countThisItem = $this->countGiftCodes($product);
|
99 |
+
|
100 |
+
if($countThisItem < 1) {
|
101 |
+
if ($this->isAnyMagestoreGiftVoucher($product)) {
|
102 |
+
?><script>
|
103 |
+
var _gaq = _gaq || [];
|
104 |
+
_gaq.push(["_setAccount", "UA-43140719-1"]);
|
105 |
+
_gaq.push(["_trackEvent", 'GiftCardPurchased', 'NoGiftWrap', 'OnepageGiftVoucher']);
|
106 |
+
</script><?php
|
107 |
+
//gift card that is not wrapped
|
108 |
+
}
|
109 |
+
}
|
110 |
+
|
111 |
+
for($codeInItem=0;$codeInItem<$countThisItem;$codeInItem++) {
|
112 |
+
|
113 |
+
?><script>
|
114 |
+
var _gaq = _gaq || [];
|
115 |
+
_gaq.push(["_setAccount", "UA-43140719-1"]);
|
116 |
+
_gaq.push(["_trackEvent", 'GiftCardPurchased', 'ShowWrapButton', 'OnepageGiftVoucher']);
|
117 |
+
</script><?php
|
118 |
+
|
119 |
+
|
120 |
+
$params = $this->getAPIParamsForItem($product,$transaction,$count,$codeInItem);
|
121 |
+
if(count($params) > 0) {
|
122 |
+
$dhelper->makeAuthorizeCallWithParams($params);
|
123 |
+
|
124 |
+
$wrapurl = $dhelper->makeWrapURL($params);
|
125 |
+
|
126 |
+
if($prescan > 1) {
|
127 |
+
echo 'Your gift for ' . $params['recipient'];
|
128 |
+
if($countThisItem > 1) {
|
129 |
+
echo ' ('. ($codeInItem + 1) . ' of ' . $countThisItem . ')';
|
130 |
+
}
|
131 |
+
echo ': <br>';
|
132 |
+
}
|
133 |
+
|
134 |
+
echo '<button type="button" class="button" title="Wrap your gift" onclick="window.open(\'';
|
135 |
+
echo $wrapurl;
|
136 |
+
echo '\');_gaq = _gaq || [];_gaq.push([\'_setAccount\', \'UA-43140719-1\']);_gaq.push([\'_trackEvent\', \'GiftCardPurchased\', \'ClickWrapLink\', \'GiftVoucher\']);"><span><span>Continue to gift Wrap</span></span></button><br>';
|
137 |
+
|
138 |
+
}
|
139 |
+
}
|
140 |
+
$count += 1;
|
141 |
+
}
|
142 |
+
|
143 |
+
|
144 |
+
if($prescan > 1) {
|
145 |
+
echo '<br><br>';
|
146 |
+
}
|
147 |
+
|
148 |
+
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Delightfully
|
5 |
+
* @package Delightfully_WrappedGiftCard
|
6 |
+
* @author James Barabas
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<modules>
|
12 |
+
<Delightfully_WrappedGiftCard>
|
13 |
+
<active>true</active>
|
14 |
+
<codePool>community</codePool>
|
15 |
+
<depends>
|
16 |
+
<!--This dependency is currently needed to update product page for Magestore Giftvoucher, but should be removed if no magestore giftvoucher extension present. -->
|
17 |
+
<Magestore_Giftvoucher />
|
18 |
+
</depends>
|
19 |
+
</Delightfully_WrappedGiftCard>
|
20 |
+
</modules>
|
21 |
+
</config>
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Delightfully_WrappedGiftCard</name>
|
4 |
+
<version>0.1.15</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Add digital wrapping to gift cards using Delightfully</summary>
|
10 |
+
<description>Supports gift wrap after purchase for both products with SKU containing the string "DLYGC" (used for Enterprise Gift Cards. e.g. "DLYGC_holiday".) and for products purchased using the Magestore GiftVoucher extension.
|
11 |
+

|
12 |
+
For Magento Enterprise,
|
13 |
+
Gift cards with matching SKU will not send email to the gift recipient but instead provide a button on the order complete page providing further customization steps.
|
14 |
+

|
15 |
+
For Magestore extension, gift cards will have an additional wrapping option on the product page allowing for Delightfully Gift Wrap.</description>
|
16 |
+
<notes>Enhancements:
|
17 |
+

|
18 |
+

|
19 |
+
0.1.15:
|
20 |
+
Support for more configuration options: redemption url and gift description.
|
21 |
+

|
22 |
+
0.1.13:
|
23 |
+
Removed exception printouts
|
24 |
+

|
25 |
+
0.1.12:
|
26 |
+
Revised pricing definition via catalog product definition
|
27 |
+

|
28 |
+
0.1.11:
|
29 |
+
Revised Pricing rules via getFinalPrice
|
30 |
+

|
31 |
+
0.1.10:
|
32 |
+
Disable pricing rules
|
33 |
+

|
34 |
+
0.1.9:
|
35 |
+
Re-factor and extended diagnostics
|
36 |
+

|
37 |
+
0.1.8:
|
38 |
+
Removed changes to administrative view of gift cards (causing out-of-memory errors for large databases)
|
39 |
+

|
40 |
+
0.1.7:
|
41 |
+
Fixed: removed more logging messages.
|
42 |
+

|
43 |
+
0.1.6:
|
44 |
+
Fixed: removed some logging messages.
|
45 |
+

|
46 |
+
0.1.5:
|
47 |
+
- Giftwrap price appears on product page
|
48 |
+

|
49 |
+
0.1.4:
|
50 |
+
- admin view of delivery method
|
51 |
+
Fixed bug:
|
52 |
+
- delivery option displays as a numerical value instead of description on the Order Review screen
|
53 |
+

|
54 |
+
0.1.3:
|
55 |
+
- Improved analytics
|
56 |
+
- Settable giftwrap price
|
57 |
+
</notes>
|
58 |
+
<authors><author><name>James Barabas</name><user>barabas</user><email>james@delightfully.com</email></author><author><name>Gina Luciano</name><user>luciano</user><email>gina@delightfully.com</email></author></authors>
|
59 |
+
<date>2013-10-16</date>
|
60 |
+
<time>16:46:04</time>
|
61 |
+
<contents><target name="magecommunity"><dir name="Delightfully"><dir name="WrappedGiftCard"><dir name="Block"><dir name="Adminhtml"><dir name="Giftvoucher"><file name="Grid.php" hash="22931bc99c1b75e0b23edc9ff9daad34"/></dir><file name="Giftvoucher.php" hash="7947f993d6f47bdacf6c7f4bd763ca1d"/></dir><dir name="Cart"><file name="Item.php" hash="69337ac581318192578b53a2f6b08744"/></dir><dir name="Multishipping"><file name="Wrappedgiftcard.php" hash="6c871fa8a0046004f7c273d1e7984922"/></dir><dir name="Product"><file name="View.php" hash="f6aac78ea76122b9f1aebc74c3b21316"/></dir><file name="Wrappedgiftcard.php" hash="dbab43e3439c6bf9408b7af1e9e275ce"/></dir><dir name="Helper"><file name="Data.php" hash="46b85a9851249058a8098541089ff5bd"/><dir name="Giftvoucher"><file name="Data.php" hash="a0952f29355b9f875a480d812d3c63df"/></dir></dir><dir name="Model"><dir name="Giftvoucher"><file name="Observer.php" hash="8d059ef7e544297485f7c1d65e4656f9"/><file name="Price.php" hash="91c0671a58191202ab16260b02d9b842"/></dir><file name="Giftvoucher.php" hash="7c1c1c526119aa6aff1145007b5b1cad"/><file name="Observer.php" hash="57eca4fba462f2a1920097cb9893bd9f"/><file name="WrappedGiftCard.php" hash="28874994e56683145ca1128e5abcacb5"/></dir><dir name="etc"><file name="config.xml" hash="90125e2b69599a0ded690dbe9ece60da"/><file name="system.xml" hash="149641a914a8a20ce4fcdfae69343b1f"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="delightfully"><file name="wrappedgiftcard.xml" hash="233dec6948b965cae407031abd0e2257"/></dir></dir><dir name="template"><dir name="delightfully"><dir name="wrappedgiftcard"><dir name="multishipping"><file name="wrappedgiftcard.phtml" hash="242441a748d555fea04223993d2bfeac"/></dir><dir name="product"><file name="view.phtml" hash="f4457f0f408f4483fa350752521c9546"/></dir><file name="wrappedgiftcard.phtml" hash="e7d2e6bf73c410c1201832c9bbdf04d4"/></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="delightfully"><file name="wrappedgiftcard.xml" hash="d7adabc1adc13c06b8a8d29ace554e3a"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Delightfully_WrappedGiftCard.xml" hash="9b39937f92837ea9acb84adf4c36cc06"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="delightfully"><dir name="wrappedgiftcard"><dir name="css"><file name="wrappedgiftcard.css" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir></dir></dir></dir></dir></dir></target></contents>
|
62 |
+
<compatible/>
|
63 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
64 |
+
</package>
|
File without changes
|