Version Notes
Stable release
Download this release
Release Info
| Developer | Nikolai Krambrock |
| Extension | c4b_freeproduct |
| Version | 0.1.0 |
| Comparing to | |
| See all releases | |
Version 0.1.0
- app/code/community/C4B/Freeproduct/Helper/Data.php +26 -0
- app/code/community/C4B/Freeproduct/Model/Consts.php +18 -0
- app/code/community/C4B/Freeproduct/Model/Observer.php +152 -0
- app/code/community/C4B/Freeproduct/etc/config.xml +89 -0
- app/code/community/C4B/Freeproduct/sql/freeproduct_setup/mysql4-install-0.1.0.php +24 -0
- app/design/frontend/base/default/template/freeproduct/checkout/cart/item/default.phtml +287 -0
- app/etc/modules/C4B_Freeproduct.xml +12 -0
- app/locale/de_DE/C4B_Freeproduct.csv +3 -0
- app/locale/en_US/C4B_Freeproduct.csv +3 -0
- package.xml +18 -0
app/code/community/C4B/Freeproduct/Helper/Data.php
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Freeproduct Module
|
| 5 |
+
*
|
| 6 |
+
* This module can be used free of carge to extend a magento system. Any other
|
| 7 |
+
* usage requires prior permission of the code4business Software GmbH. The module
|
| 8 |
+
* comes without any kind of warranty.
|
| 9 |
+
*
|
| 10 |
+
* @category C4B
|
| 11 |
+
* @package C4B_Freeproduct
|
| 12 |
+
* @author Nikolai Krambrock <freeproduct@code4business.de>
|
| 13 |
+
* @copyright code4business Software GmbH
|
| 14 |
+
* @version 0.1.0
|
| 15 |
+
*/
|
| 16 |
+
class C4B_Freeproduct_Helper_Data extends Mage_Core_Helper_Abstract {
|
| 17 |
+
|
| 18 |
+
/**
|
| 19 |
+
* This logs a message in a custom log file.
|
| 20 |
+
*
|
| 21 |
+
* @param string $msg
|
| 22 |
+
*/
|
| 23 |
+
public function log($msg) {
|
| 24 |
+
Mage::log($msg, Zend_Log::INFO, 'freeproduct.log');
|
| 25 |
+
}
|
| 26 |
+
}
|
app/code/community/C4B/Freeproduct/Model/Consts.php
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Freeproduct Module
|
| 5 |
+
*
|
| 6 |
+
* This module can be used free of carge to extend a magento system. Any other
|
| 7 |
+
* usage requires prior permission of the code4business Software GmbH. The module
|
| 8 |
+
* comes without any kind of warranty.
|
| 9 |
+
*
|
| 10 |
+
* @category C4B
|
| 11 |
+
* @package C4B_Freeproduct
|
| 12 |
+
* @author Nikolai Krambrock <freeproduct@code4business.de>
|
| 13 |
+
* @copyright code4business Software GmbH
|
| 14 |
+
* @version 0.1.0
|
| 15 |
+
*/
|
| 16 |
+
class C4B_Freeproduct_Model_Consts {
|
| 17 |
+
const ADD_GIFT_ACTION = 'add_gift';
|
| 18 |
+
}
|
app/code/community/C4B/Freeproduct/Model/Observer.php
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Freeproduct Module
|
| 5 |
+
*
|
| 6 |
+
* This module can be used free of carge to extend a magento system. Any other
|
| 7 |
+
* usage requires prior permission of the code4business Software GmbH. The module
|
| 8 |
+
* comes without any kind of warranty.
|
| 9 |
+
*
|
| 10 |
+
* @category C4B
|
| 11 |
+
* @package C4B_Freeproduct
|
| 12 |
+
* @author Nikolai Krambrock <freeproduct@code4business.de>
|
| 13 |
+
* @copyright code4business Software GmbH
|
| 14 |
+
* @version 0.1.0
|
| 15 |
+
*/
|
| 16 |
+
class C4B_Freeproduct_Model_Observer {
|
| 17 |
+
|
| 18 |
+
/**
|
| 19 |
+
* Delete all free products that have been added through this module before.
|
| 20 |
+
* This is done before discounts are given in on the event
|
| 21 |
+
* 'sales_quote_collect_totals_before'.
|
| 22 |
+
*
|
| 23 |
+
* @param Varien_Event_Observer $observer
|
| 24 |
+
*/
|
| 25 |
+
public function salesQuoteCollectTotalsBefore(Varien_Event_Observer $observer) {
|
| 26 |
+
self::_resetFreeItems($observer->getEvent()->getQuote());
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* Add gifts to the cart, if the current salesrule is of simple action
|
| 31 |
+
* ADD_GIFT_ACTION. The rule has been validated before the event
|
| 32 |
+
* 'salesrule_validator_process' is thrown that we catch.
|
| 33 |
+
*
|
| 34 |
+
* @param Varien_Event_Observer $observer
|
| 35 |
+
*/
|
| 36 |
+
public function salesruleValidatorProcess(Varien_Event_Observer $observer) {
|
| 37 |
+
/* @var $quote Mage_Sales_Model_Quote */
|
| 38 |
+
$quote = $observer->getEvent()->getQuote();
|
| 39 |
+
/* @var $item Mage_Sales_Model_Quote_Item */
|
| 40 |
+
$item = $observer->getEvent()->getItem();
|
| 41 |
+
/* @var $rule Mage_SalesRule_Model_Rule */
|
| 42 |
+
$rule = $observer->getEvent()->getRule();
|
| 43 |
+
|
| 44 |
+
if ($rule->getSimpleAction() == C4B_Freeproduct_Model_Consts::ADD_GIFT_ACTION &&
|
| 45 |
+
!$item->getIsFreeProduct()) {
|
| 46 |
+
self::_handleGift($quote, $item, $rule);
|
| 47 |
+
}
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
/**
|
| 51 |
+
* Add a new simple action to the salesrule in the backen. In the combo-box
|
| 52 |
+
* you can now select 'Add a Gift' as one possible result of the given rule
|
| 53 |
+
* evaluation positive. Additionally you have to enter a sku of the gift that
|
| 54 |
+
* you want to make.
|
| 55 |
+
*
|
| 56 |
+
* @param Varien_Event_Observer $observer
|
| 57 |
+
*/
|
| 58 |
+
public function adminhtmlBlockSalesruleActionsPrepareform($observer) {
|
| 59 |
+
$field = $observer->getForm()->getElement('simple_action');
|
| 60 |
+
$options = $field->getValues();
|
| 61 |
+
$options[] = array(
|
| 62 |
+
'value' => C4B_Freeproduct_Model_Consts::ADD_GIFT_ACTION,
|
| 63 |
+
'label' => Mage::helper('freeproduct')->__('Add a Gift')
|
| 64 |
+
);
|
| 65 |
+
$field->setValues($options);
|
| 66 |
+
|
| 67 |
+
$fieldset = $observer->getForm()->getElement('action_fieldset');
|
| 68 |
+
$fieldset->addField('gift_sku', 'text', array(
|
| 69 |
+
'name' => 'gift_sku',
|
| 70 |
+
'label' => Mage::helper('freeproduct')->__('Gift SKU'),
|
| 71 |
+
'title' => Mage::helper('freeproduct')->__('Gift SKU'),
|
| 72 |
+
'note' => Mage::helper('freeproduct')->__('Enter the SKU of the gift that should be added to the cart'),
|
| 73 |
+
));
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
/**
|
| 77 |
+
* Make sure that a gift is only added once, create a free item and add it to the cart.
|
| 78 |
+
*
|
| 79 |
+
* @param Mage_Sales_Model_Quote $quote
|
| 80 |
+
* @param Mage_Sales_Model_Quote_Item $item
|
| 81 |
+
* @param Mage_Sales_Model_Quote_Item $rule
|
| 82 |
+
*/
|
| 83 |
+
protected static function _handleGift(Mage_Sales_Model_Quote $quote,
|
| 84 |
+
Mage_Sales_Model_Quote_Item $item,
|
| 85 |
+
Mage_SalesRule_Model_Rule $rule) {
|
| 86 |
+
if ($rule->getIsApplied()) {
|
| 87 |
+
return;
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
$qty = (integer) $rule->getDiscountAmount();
|
| 91 |
+
if ($qty) {
|
| 92 |
+
$freeItem = self::_getFreeQuoteItem($quote, $rule->getGiftSku(), $item->getStoreId(), $qty);
|
| 93 |
+
self::_addAndApply($quote, $freeItem, $rule);
|
| 94 |
+
}
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
/**
|
| 98 |
+
* Create a free item. It has a value of 0$ in the cart no matter what the price was
|
| 99 |
+
* originally.
|
| 100 |
+
*
|
| 101 |
+
* @param Mage_Sales_Model_Quote $quote
|
| 102 |
+
* @param string $sku
|
| 103 |
+
* @param int $storeId
|
| 104 |
+
* @param int $qty
|
| 105 |
+
* @return Mage_Sales_Quote_Item
|
| 106 |
+
*/
|
| 107 |
+
protected static function _getFreeQuoteItem(Mage_Sales_Model_Quote $quote, $sku, $storeId, $qty) {
|
| 108 |
+
if ($qty < 1) {
|
| 109 |
+
return;
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
$product = Mage::getModel('catalog/product')->loadByAttribute('sku', $sku);
|
| 113 |
+
Mage::getModel('cataloginventory/stock_item')->assignProduct($product);
|
| 114 |
+
$quoteItem = Mage::getModel('sales/quote_item')->setProduct($product);
|
| 115 |
+
$quoteItem->setQuote($quote)
|
| 116 |
+
->setQty($qty)
|
| 117 |
+
->setCustomPrice(0.0)
|
| 118 |
+
->setOriginalCustomPrice($product->getPrice())
|
| 119 |
+
->setIsFreeProduct(true)
|
| 120 |
+
->setStoreId($storeId);
|
| 121 |
+
|
| 122 |
+
return $quoteItem;
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
/**
|
| 126 |
+
* Add a free item and mark that the rule was used on this item.
|
| 127 |
+
*
|
| 128 |
+
* @param Mage_Sales_Model_Quote $quote
|
| 129 |
+
* @param Mage_Sales_Model_Quote_Item $item
|
| 130 |
+
* @param Mage_Sales_Model_Quote_Item $rule
|
| 131 |
+
*/
|
| 132 |
+
protected static function _addAndApply(Mage_Sales_Model_Quote $quote,
|
| 133 |
+
Mage_Sales_Model_Quote_Item $item,
|
| 134 |
+
Mage_SalesRule_Model_Rule $rule) {
|
| 135 |
+
$quote->addItem($item);
|
| 136 |
+
$item->setApplyingRule($rule);
|
| 137 |
+
$rule->setIsApplied(true);
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
/**
|
| 141 |
+
* Delete all free items from the cart.
|
| 142 |
+
*
|
| 143 |
+
* @param Mage_Sales_Model_Quote $quote
|
| 144 |
+
*/
|
| 145 |
+
protected static function _resetFreeItems(Mage_Sales_Model_Quote $quote) {
|
| 146 |
+
foreach ($quote->getAllItems() as $item) {
|
| 147 |
+
if ($item->getIsFreeProduct()) {
|
| 148 |
+
$quote->removeItem($item->getId());
|
| 149 |
+
}
|
| 150 |
+
}
|
| 151 |
+
}
|
| 152 |
+
}
|
app/code/community/C4B/Freeproduct/etc/config.xml
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<C4B_Freeproduct>
|
| 5 |
+
<version>0.1.0</version>
|
| 6 |
+
</C4B_Freeproduct>
|
| 7 |
+
</modules>
|
| 8 |
+
<global>
|
| 9 |
+
<models>
|
| 10 |
+
<freeproduct>
|
| 11 |
+
<class>C4B_Freeproduct_Model</class>
|
| 12 |
+
</freeproduct>
|
| 13 |
+
</models>
|
| 14 |
+
<helpers>
|
| 15 |
+
<freeproduct>
|
| 16 |
+
<class>C4B_Freeproduct_Helper</class>
|
| 17 |
+
</freeproduct>
|
| 18 |
+
</helpers>
|
| 19 |
+
<resources>
|
| 20 |
+
<freeproduct_setup>
|
| 21 |
+
<setup>
|
| 22 |
+
<module>C4B_Freeproduct</module>
|
| 23 |
+
<class>Mage_Eav_Model_Entity_Setup</class>
|
| 24 |
+
</setup>
|
| 25 |
+
<connection>
|
| 26 |
+
<use>core_setup</use>
|
| 27 |
+
</connection>
|
| 28 |
+
</freeproduct_setup>
|
| 29 |
+
</resources>
|
| 30 |
+
<fieldsets>
|
| 31 |
+
<sales_convert_quote_item>
|
| 32 |
+
<is_free_product>
|
| 33 |
+
<to_order_item>is_free_product</to_order_item>
|
| 34 |
+
</is_free_product>
|
| 35 |
+
</sales_convert_quote_item>
|
| 36 |
+
</fieldsets>
|
| 37 |
+
</global>
|
| 38 |
+
<adminhtml>
|
| 39 |
+
<events>
|
| 40 |
+
<adminhtml_block_salesrule_actions_prepareform>
|
| 41 |
+
<observers>
|
| 42 |
+
<freeproduct>
|
| 43 |
+
<type>model</type>
|
| 44 |
+
<class>freeproduct/observer</class>
|
| 45 |
+
<method>adminhtmlBlockSalesruleActionsPrepareform</method>
|
| 46 |
+
</freeproduct>
|
| 47 |
+
</observers>
|
| 48 |
+
</adminhtml_block_salesrule_actions_prepareform>
|
| 49 |
+
</events>
|
| 50 |
+
<translate>
|
| 51 |
+
<modules>
|
| 52 |
+
<C4B_Freeproduct>
|
| 53 |
+
<files>
|
| 54 |
+
<default>C4B_Freeproduct.csv</default>
|
| 55 |
+
</files>
|
| 56 |
+
</C4B_Freeproduct>
|
| 57 |
+
</modules>
|
| 58 |
+
</translate>
|
| 59 |
+
</adminhtml>
|
| 60 |
+
<frontend>
|
| 61 |
+
<layout>
|
| 62 |
+
<updates>
|
| 63 |
+
<freeproduct>
|
| 64 |
+
<file>freeproduct.xml</file>
|
| 65 |
+
</freeproduct>
|
| 66 |
+
</updates>
|
| 67 |
+
</layout>
|
| 68 |
+
<events>
|
| 69 |
+
<salesrule_validator_process>
|
| 70 |
+
<observers>
|
| 71 |
+
<freeproduct>
|
| 72 |
+
<type>model</type>
|
| 73 |
+
<class>freeproduct/observer</class>
|
| 74 |
+
<method>salesruleValidatorProcess</method>
|
| 75 |
+
</freeproduct>
|
| 76 |
+
</observers>
|
| 77 |
+
</salesrule_validator_process>
|
| 78 |
+
<sales_quote_collect_totals_before>
|
| 79 |
+
<observers>
|
| 80 |
+
<freeproduct>
|
| 81 |
+
<type>model</type>
|
| 82 |
+
<class>freeproduct/observer</class>
|
| 83 |
+
<method>salesQuoteCollectTotalsBefore</method>
|
| 84 |
+
</freeproduct>
|
| 85 |
+
</observers>
|
| 86 |
+
</sales_quote_collect_totals_before>
|
| 87 |
+
</events>
|
| 88 |
+
</frontend>
|
| 89 |
+
</config>
|
app/code/community/C4B/Freeproduct/sql/freeproduct_setup/mysql4-install-0.1.0.php
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Freeproduct Module
|
| 4 |
+
*
|
| 5 |
+
* This module can be used free of carge to extend a magento system. Any other
|
| 6 |
+
* usage requires prior permission of the code4business Software GmbH. The module
|
| 7 |
+
* comes without any kind of warranty.
|
| 8 |
+
*
|
| 9 |
+
* @category C4B
|
| 10 |
+
* @package C4B_Freeproduct
|
| 11 |
+
* @author Nikolai Krambrock <freeproduct@code4business.de>
|
| 12 |
+
* @copyright code4business Software GmbH
|
| 13 |
+
* @version 0.1.0
|
| 14 |
+
*/
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* @var $installer Mage_Sales_Model_Mysql4_Setup
|
| 18 |
+
*/
|
| 19 |
+
$installer = $this;
|
| 20 |
+
$installer->startSetup();
|
| 21 |
+
$installer->getConnection()->addColumn($installer->getTable('sales/quote_item'), 'is_free_product', "tinyint(4) NOT NULL default '0'");
|
| 22 |
+
$installer->getConnection()->addColumn($installer->getTable('sales/order_item'), 'is_free_product', "tinyint(4) NOT NULL default '0'");
|
| 23 |
+
$installer->getConnection()->addColumn($installer->getTable('salesrule'), 'gift_sku', "varchar(255) NOT NULL default ''");
|
| 24 |
+
$installer->endSetup();
|
app/design/frontend/base/default/template/freeproduct/checkout/cart/item/default.phtml
ADDED
|
@@ -0,0 +1,287 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
| 8 |
+
* that is bundled with this package 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) 2011 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
|
| 28 |
+
$_item = $this->getItem();
|
| 29 |
+
$isVisibleProduct = $_item->getProduct()->isVisibleInSiteVisibility();
|
| 30 |
+
$canApplyMsrp = Mage::helper('catalog')->canApplyMsrp($_item->getProduct(), Mage_Catalog_Model_Product_Attribute_Source_Msrp_Type::TYPE_BEFORE_ORDER_CONFIRM);
|
| 31 |
+
?>
|
| 32 |
+
<tr>
|
| 33 |
+
<td><?php if ($this->hasProductUrl()):?><a href="<?php echo $this->getProductUrl() ?>" title="<?php echo $this->htmlEscape($this->getProductName()) ?>" class="product-image"><?php endif;?><img src="<?php echo $this->getProductThumbnail()->resize(75); ?>" width="75" height="75" alt="<?php echo $this->htmlEscape($this->getProductName()) ?>" /><?php if ($this->hasProductUrl()):?></a><?php endif;?></td>
|
| 34 |
+
<td>
|
| 35 |
+
<h2 class="product-name">
|
| 36 |
+
<?php if ($this->hasProductUrl()):?>
|
| 37 |
+
<a href="<?php echo $this->getProductUrl() ?>"><?php echo $this->htmlEscape($this->getProductName()) ?></a>
|
| 38 |
+
<?php else: ?>
|
| 39 |
+
<?php echo $this->htmlEscape($this->getProductName()) ?>
|
| 40 |
+
<?php endif; ?>
|
| 41 |
+
</h2>
|
| 42 |
+
<?php if ($_options = $this->getOptionList()):?>
|
| 43 |
+
<dl class="item-options">
|
| 44 |
+
<?php foreach ($_options as $_option) : ?>
|
| 45 |
+
<?php $_formatedOptionValue = $this->getFormatedOptionValue($_option) ?>
|
| 46 |
+
<dt><?php echo $this->htmlEscape($_option['label']) ?></dt>
|
| 47 |
+
<dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated"<?php endif; ?>><?php echo $_formatedOptionValue['value'] ?>
|
| 48 |
+
<?php if (isset($_formatedOptionValue['full_view'])): ?>
|
| 49 |
+
<div class="truncated_full_value">
|
| 50 |
+
<dl class="item-options">
|
| 51 |
+
<dt><?php echo $this->htmlEscape($_option['label']) ?></dt>
|
| 52 |
+
<dd><?php echo $_formatedOptionValue['full_view'] ?></dd>
|
| 53 |
+
</dl>
|
| 54 |
+
</div>
|
| 55 |
+
<?php endif; ?>
|
| 56 |
+
</dd>
|
| 57 |
+
<?php endforeach; ?>
|
| 58 |
+
</dl>
|
| 59 |
+
<?php endif;?>
|
| 60 |
+
<?php if ($messages = $this->getMessages()): ?>
|
| 61 |
+
<?php foreach ($messages as $message): ?>
|
| 62 |
+
<p class="item-msg <?php echo $message['type'] ?>">* <?php echo $message['text'] ?></p>
|
| 63 |
+
<?php endforeach; ?>
|
| 64 |
+
<?php endif; ?>
|
| 65 |
+
<?php if ($addtInfoBlock = $this->getProductAdditionalInformationBlock()):?>
|
| 66 |
+
<?php echo $addtInfoBlock->setItem($_item)->toHtml() ?>
|
| 67 |
+
<?php endif;?>
|
| 68 |
+
</td>
|
| 69 |
+
<td class="a-center">
|
| 70 |
+
<?php if ($isVisibleProduct): ?>
|
| 71 |
+
<a href="<?php echo $this->getConfigureUrl() ?>" title="<?php echo $this->__('Edit item parameters') ?>"><?php echo $this->__('Edit') ?></a>
|
| 72 |
+
<?php endif ?>
|
| 73 |
+
</td>
|
| 74 |
+
<?php if ($this->helper('wishlist')->isAllowInCart()) : ?>
|
| 75 |
+
<td class="a-center">
|
| 76 |
+
<?php if ($isVisibleProduct): ?>
|
| 77 |
+
<input type="checkbox" value="1" name="cart[<?php echo $_item->getId() ?>][wishlist]" title="<?php echo $this->__('Move to Wishlist') ?>" class="checkbox" />
|
| 78 |
+
<?php endif ?>
|
| 79 |
+
</td>
|
| 80 |
+
<?php endif ?>
|
| 81 |
+
|
| 82 |
+
<?php if ($canApplyMsrp): ?>
|
| 83 |
+
<td class="a-right"<?php if ($this->helper('tax')->displayCartBothPrices()): ?> colspan="2"<?php endif; ?>>
|
| 84 |
+
<span class="cart-price">
|
| 85 |
+
<span class="cart-msrp-unit"><?php echo $this->__('See price before order confirmation.'); ?></span>
|
| 86 |
+
<?php $helpLinkId = 'cart-msrp-help-' . $_item->getId(); ?>
|
| 87 |
+
<a id="<?php echo $helpLinkId ?>" href="#" class="map-help-link"><?php echo $this->__("What's this?"); ?></a>
|
| 88 |
+
<script type="text/javascript">
|
| 89 |
+
Catalog.Map.addHelpLink($('<?php echo $helpLinkId ?>'), "<?php echo $this->__("What's this?") ?>");
|
| 90 |
+
</script>
|
| 91 |
+
</span>
|
| 92 |
+
</td>
|
| 93 |
+
<?php else: ?>
|
| 94 |
+
|
| 95 |
+
<?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
| 96 |
+
<td class="a-right">
|
| 97 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
| 98 |
+
<span class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
| 99 |
+
<?php else: ?>
|
| 100 |
+
<span class="cart-price">
|
| 101 |
+
<?php endif; ?>
|
| 102 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
| 103 |
+
<?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?>
|
| 104 |
+
<?php else: ?>
|
| 105 |
+
<?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>
|
| 106 |
+
<?php endif; ?>
|
| 107 |
+
|
| 108 |
+
</span>
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
| 112 |
+
|
| 113 |
+
<div class="cart-tax-info" id="eunit-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
|
| 114 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
| 115 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
| 116 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span>
|
| 117 |
+
<?php endforeach; ?>
|
| 118 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
| 119 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
| 120 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span>
|
| 121 |
+
<?php endforeach; ?>
|
| 122 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
| 123 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
| 124 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span>
|
| 125 |
+
<?php endforeach; ?>
|
| 126 |
+
<?php endif; ?>
|
| 127 |
+
</div>
|
| 128 |
+
|
| 129 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
| 130 |
+
<div class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
| 131 |
+
<span class="weee"><?php echo Mage::helper('weee')->__('Total'); ?>: <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?></span>
|
| 132 |
+
</div>
|
| 133 |
+
<?php endif; ?>
|
| 134 |
+
<?php endif; ?>
|
| 135 |
+
</td>
|
| 136 |
+
<?php endif; ?>
|
| 137 |
+
<?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
| 138 |
+
<td>
|
| 139 |
+
<?php $_incl = $this->helper('checkout')->getPriceInclTax($_item); ?>
|
| 140 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
| 141 |
+
<span class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
| 142 |
+
<?php else: ?>
|
| 143 |
+
<span class="cart-price">
|
| 144 |
+
<?php endif; ?>
|
| 145 |
+
|
| 146 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
| 147 |
+
<?php echo $this->helper('checkout')->formatPrice($_incl+$_item->getWeeeTaxAppliedAmount()); ?>
|
| 148 |
+
<?php else: ?>
|
| 149 |
+
<?php echo $this->helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxDisposition()) ?>
|
| 150 |
+
<?php endif; ?>
|
| 151 |
+
|
| 152 |
+
</span>
|
| 153 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
| 154 |
+
|
| 155 |
+
<div class="cart-tax-info" id="unit-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
|
| 156 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
| 157 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
| 158 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span>
|
| 159 |
+
<?php endforeach; ?>
|
| 160 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
| 161 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
| 162 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span>
|
| 163 |
+
<?php endforeach; ?>
|
| 164 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
| 165 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
| 166 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span>
|
| 167 |
+
<?php endforeach; ?>
|
| 168 |
+
<?php endif; ?>
|
| 169 |
+
</div>
|
| 170 |
+
|
| 171 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
| 172 |
+
<div class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
| 173 |
+
<span class="weee"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>: <?php echo $this->helper('checkout')->formatPrice($_incl+$_item->getWeeeTaxAppliedAmount()); ?></span>
|
| 174 |
+
</div>
|
| 175 |
+
<?php endif; ?>
|
| 176 |
+
<?php endif; ?>
|
| 177 |
+
</td>
|
| 178 |
+
<?php endif; ?>
|
| 179 |
+
<?php endif; ?>
|
| 180 |
+
<td class="a-center">
|
| 181 |
+
<?php // THE NEXT 5 LINES ARE CHANGED BY C4B FOR FREEPRODUCT: The qty of Freeproducts is not editable ?>
|
| 182 |
+
<?php if ($_item->getIsFreeProduct()) : ?>
|
| 183 |
+
<?php echo $this->getQty() ?>
|
| 184 |
+
<?php else: ?>
|
| 185 |
+
<input name="cart[<?php echo $_item->getId() ?>][qty]" value="<?php echo $this->getQty() ?>" size="4" title="<?php echo $this->__('Qty') ?>" class="input-text qty" maxlength="12" />
|
| 186 |
+
<?php endif; ?>
|
| 187 |
+
</td>
|
| 188 |
+
<?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
| 189 |
+
<td class="a-right">
|
| 190 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
| 191 |
+
<span class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
| 192 |
+
<?php else: ?>
|
| 193 |
+
<span class="cart-price">
|
| 194 |
+
<?php endif; ?>
|
| 195 |
+
|
| 196 |
+
<?php if ($canApplyMsrp): ?>
|
| 197 |
+
<span class="cart-msrp-subtotal">--</span>
|
| 198 |
+
<?php else: ?>
|
| 199 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
| 200 |
+
<?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
|
| 201 |
+
<?php else: ?>
|
| 202 |
+
<?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()) ?>
|
| 203 |
+
<?php endif; ?>
|
| 204 |
+
<?php endif; ?>
|
| 205 |
+
|
| 206 |
+
</span>
|
| 207 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
| 208 |
+
|
| 209 |
+
<div class="cart-tax-info" id="esubtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
|
| 210 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
| 211 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
| 212 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'],true,true); ?></span>
|
| 213 |
+
<?php endforeach; ?>
|
| 214 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
| 215 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
| 216 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span>
|
| 217 |
+
<?php endforeach; ?>
|
| 218 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
| 219 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
| 220 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span>
|
| 221 |
+
<?php endforeach; ?>
|
| 222 |
+
<?php endif; ?>
|
| 223 |
+
</div>
|
| 224 |
+
|
| 225 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
| 226 |
+
<div class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
| 227 |
+
<span class="weee"><?php echo Mage::helper('weee')->__('Total'); ?>: <?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?></span>
|
| 228 |
+
</div>
|
| 229 |
+
<?php endif; ?>
|
| 230 |
+
<?php endif; ?>
|
| 231 |
+
</td>
|
| 232 |
+
<?php endif; ?>
|
| 233 |
+
<?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
| 234 |
+
<td>
|
| 235 |
+
<?php $_incl = $this->helper('checkout')->getSubtotalInclTax($_item); ?>
|
| 236 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
| 237 |
+
<span class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
| 238 |
+
<?php else: ?>
|
| 239 |
+
<span class="cart-price">
|
| 240 |
+
<?php endif; ?>
|
| 241 |
+
|
| 242 |
+
<?php if ($canApplyMsrp): ?>
|
| 243 |
+
<span class="cart-msrp-subtotal">--</span>
|
| 244 |
+
<?php else: ?>
|
| 245 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
| 246 |
+
<?php echo $this->helper('checkout')->formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
|
| 247 |
+
<?php else: ?>
|
| 248 |
+
<?php echo $this->helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxRowDisposition()) ?>
|
| 249 |
+
<?php endif; ?>
|
| 250 |
+
<?php endif; ?>
|
| 251 |
+
|
| 252 |
+
</span>
|
| 253 |
+
|
| 254 |
+
|
| 255 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
| 256 |
+
|
| 257 |
+
<div class="cart-tax-info" id="subtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
|
| 258 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
| 259 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
| 260 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'],true,true); ?></span>
|
| 261 |
+
<?php endforeach; ?>
|
| 262 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
| 263 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
| 264 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span>
|
| 265 |
+
<?php endforeach; ?>
|
| 266 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
| 267 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
| 268 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span>
|
| 269 |
+
<?php endforeach; ?>
|
| 270 |
+
<?php endif; ?>
|
| 271 |
+
</div>
|
| 272 |
+
|
| 273 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
| 274 |
+
<div class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
| 275 |
+
<span class="weee"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>: <?php echo $this->helper('checkout')->formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?></span>
|
| 276 |
+
</div>
|
| 277 |
+
<?php endif; ?>
|
| 278 |
+
<?php endif; ?>
|
| 279 |
+
</td>
|
| 280 |
+
<?php endif; ?>
|
| 281 |
+
<?php // THE NEXT 5 LINES ARE CHANGED BY C4B FOR FREEPRODUCT: Freeproducts are not deletable ?>
|
| 282 |
+
<td class="a-center">
|
| 283 |
+
<?php if (!$_item->getIsFreeProduct()) : ?>
|
| 284 |
+
<a href="<?php echo $this->getDeleteUrl()?>" title="<?php echo $this->__('Remove item')?>" class="btn-remove btn-remove2"><?php echo $this->__('Remove item')?></a>
|
| 285 |
+
<?php endif; ?>
|
| 286 |
+
</td>
|
| 287 |
+
</tr>
|
app/etc/modules/C4B_Freeproduct.xml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<C4B_Freeproduct>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>community</codePool>
|
| 7 |
+
<depends>
|
| 8 |
+
<Mage_Sales />
|
| 9 |
+
</depends>
|
| 10 |
+
</C4B_Freeproduct>
|
| 11 |
+
</modules>
|
| 12 |
+
</config>
|
app/locale/de_DE/C4B_Freeproduct.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"Gift SKU","Gift SKU"
|
| 2 |
+
"Enter the SKU of the gift that should be added to the cart","Geben sie die SKU des Geschenks ein, dass dem Warenkorb hinzugefügt werden soll"
|
| 3 |
+
"Add a Gift","Ein Geschenk hinzufügen"
|
app/locale/en_US/C4B_Freeproduct.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"Gift SKU","Gift SKU"
|
| 2 |
+
"Enter the SKU of the gift that should be added to the cart","Enter the SKU of the gift that should be added to the cart"
|
| 3 |
+
"Add a Gift","Add a Gift"
|
package.xml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>c4b_freeproduct</name>
|
| 4 |
+
<version>0.1.0</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license uri="http://www.opensource.org/licenses/bsd-license.php">BSDL</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>The module adds new action type for shipping cart price rule. That is "Add a Gift". When this rule is triggered the Gift is added to cart.</summary>
|
| 10 |
+
<description>The module adds new action type for shipping cart price rule. That is "Add a Gift". When this rule is triggered the Gift is added to cart.</description>
|
| 11 |
+
<notes>Stable release</notes>
|
| 12 |
+
<authors><author><name>Nikolai Krambrock</name><user>nkrambrock</user><email>krambrock@code4business.de</email></author></authors>
|
| 13 |
+
<date>2012-05-30</date>
|
| 14 |
+
<time>10:18:46</time>
|
| 15 |
+
<contents><target name="magecommunity"><dir name="C4B"><dir name="Freeproduct"><dir name="Helper"><file name="Data.php" hash="1a8984377402af45b2773fa29339ba0c"/></dir><dir name="Model"><file name="Consts.php" hash="6783c4c1f964980df1800d732b697deb"/><file name="Observer.php" hash="e4265906dd57e2ac6d00a26d66f3bf9d"/></dir><dir name="etc"><file name="config.xml" hash="eb25439c29b5a5406be5e5e6fe750323"/></dir><dir name="sql"><dir name="freeproduct_setup"><file name="mysql4-install-0.1.0.php" hash="088b65e5beaf22491ab94bc9e90e49e6"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="freeproduct"><dir name="checkout"><dir name="cart"><dir name="item"><file name="default.phtml" hash="d17626740d4c89ca2d091b419cf03f7f"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="C4B_Freeproduct.xml" hash="71078f494d1923f1f9da80ee93723a6d"/></dir></target><target name="magelocale"><dir name="de_DE"><file name="C4B_Freeproduct.csv" hash="24064cd8065aa7cd24cf09d73dbfc024"/></dir><dir name="en_US"><file name="C4B_Freeproduct.csv" hash="c5561e9d181a95662319657eba632aca"/></dir></target></contents>
|
| 16 |
+
<compatible/>
|
| 17 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name>Mage_Sales</name><channel>core</channel><min></min><max></max></package></required></dependencies>
|
| 18 |
+
</package>
|
