Version Notes
Fixed validation bug (alert says selecting all agreements even though all are selected)
Download this release
Release Info
| Developer | Xiliang Sun |
| Extension | TheSunWeb_ConditionalTerms |
| Version | 1.2.0 |
| Comparing to | |
| See all releases | |
Code changes from version 1.1.0 to 1.2.0
- app/code/community/TheSunWeb/ConditionalTerms/Block/Adminhtml/Checkout/Agreement/Edit/Form.php +0 -0
- app/code/community/TheSunWeb/ConditionalTerms/Block/Checkout/Agreements.php +0 -0
- app/code/community/TheSunWeb/ConditionalTerms/Helper/Checkout.php +26 -0
- app/code/community/TheSunWeb/ConditionalTerms/Helper/Data.php +4 -0
- app/code/community/TheSunWeb/ConditionalTerms/Model/Checkout/Agreement.php +0 -0
- app/code/community/TheSunWeb/ConditionalTerms/Model/Observer.php +0 -0
- app/code/community/TheSunWeb/ConditionalTerms/controllers/Adminhtml/Checkout/AgreementController.php +0 -0
- app/code/community/TheSunWeb/ConditionalTerms/etc/config.xml +5 -0
- app/code/community/TheSunWeb/ConditionalTerms/sql/cterms_setup/mysql4-install-1.0.0.php +0 -0
- app/code/community/TheSunWeb/ConditionalTerms/sql/cterms_setup/mysql4-upgrade-1.0.0-1.1.0.php +0 -0
- app/design/adminhtml/default/default/layout/cterms.xml +0 -0
- app/etc/modules/TheSunWeb_ConditionalTerms.xml +0 -0
- package.xml +6 -6
app/code/community/TheSunWeb/ConditionalTerms/Block/Adminhtml/Checkout/Agreement/Edit/Form.php
CHANGED
|
File without changes
|
app/code/community/TheSunWeb/ConditionalTerms/Block/Checkout/Agreements.php
CHANGED
|
File without changes
|
app/code/community/TheSunWeb/ConditionalTerms/Helper/Checkout.php
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class TheSunWeb_ConditionalTerms_Helper_Checkout extends Mage_Checkout_Helper_Data
|
| 3 |
+
{
|
| 4 |
+
public function getRequiredAgreementIds()
|
| 5 |
+
{
|
| 6 |
+
if (is_null($this->_agreements)) {
|
| 7 |
+
if (!Mage::getStoreConfigFlag('checkout/options/enable_agreements')) {
|
| 8 |
+
$this->_agreements = array();
|
| 9 |
+
} else {
|
| 10 |
+
$agreements = Mage::getModel('checkout/agreement')->getCollection()
|
| 11 |
+
->addStoreFilter(Mage::app()->getStore()->getId())
|
| 12 |
+
->addFieldToFilter('is_active', 1);
|
| 13 |
+
|
| 14 |
+
$address = Mage::getSingleton('checkout/session')->getQuote()->getShippingAddress();
|
| 15 |
+
foreach($agreements as $agreement) {
|
| 16 |
+
if(!$agreement->getConditions()->validate($address)) {
|
| 17 |
+
$agreements->removeItemByKey($agreement->getId());
|
| 18 |
+
}
|
| 19 |
+
}
|
| 20 |
+
$this->_agreements = $agreements->getAllIds();
|
| 21 |
+
var_dump($this->_agreements);exit();
|
| 22 |
+
}
|
| 23 |
+
}
|
| 24 |
+
return $this->_agreements;
|
| 25 |
+
}
|
| 26 |
+
}
|
app/code/community/TheSunWeb/ConditionalTerms/Helper/Data.php
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class TheSunWeb_ConditionalTerms_Helper_Data extends Mage_Core_Helper_Abstract
|
| 3 |
+
{
|
| 4 |
+
}
|
app/code/community/TheSunWeb/ConditionalTerms/Model/Checkout/Agreement.php
CHANGED
|
File without changes
|
app/code/community/TheSunWeb/ConditionalTerms/Model/Observer.php
CHANGED
|
File without changes
|
app/code/community/TheSunWeb/ConditionalTerms/controllers/Adminhtml/Checkout/AgreementController.php
CHANGED
|
File without changes
|
app/code/community/TheSunWeb/ConditionalTerms/etc/config.xml
CHANGED
|
@@ -10,6 +10,11 @@
|
|
| 10 |
<cterms>
|
| 11 |
<class>TheSunWeb_ConditionalTerms_Helper</class>
|
| 12 |
</cterms>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
</helpers>
|
| 14 |
<blocks>
|
| 15 |
<cterms>
|
| 10 |
<cterms>
|
| 11 |
<class>TheSunWeb_ConditionalTerms_Helper</class>
|
| 12 |
</cterms>
|
| 13 |
+
<checkout>
|
| 14 |
+
<rewrite>
|
| 15 |
+
<data>TheSunWeb_ConditionalTerms_Helper_Checkout</data>
|
| 16 |
+
</rewrite>
|
| 17 |
+
</checkout>
|
| 18 |
</helpers>
|
| 19 |
<blocks>
|
| 20 |
<cterms>
|
app/code/community/TheSunWeb/ConditionalTerms/sql/cterms_setup/mysql4-install-1.0.0.php
CHANGED
|
File without changes
|
app/code/community/TheSunWeb/ConditionalTerms/sql/cterms_setup/mysql4-upgrade-1.0.0-1.1.0.php
CHANGED
|
File without changes
|
app/design/adminhtml/default/default/layout/cterms.xml
CHANGED
|
File without changes
|
app/etc/modules/TheSunWeb_ConditionalTerms.xml
CHANGED
|
File without changes
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>TheSunWeb_ConditionalTerms</name>
|
| 4 |
-
<version>1.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>OSL</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -9,11 +9,11 @@
|
|
| 9 |
<summary>Multiple Dynamic Terms and Agreements Management</summary>
|
| 10 |
<description>Allows website to show different agreements and terms base on different products, categories, cart total, shipping address and etc in cart. 
|
| 11 |
Its inspired and requested by https://community.magento.com/t5/Programming-Questions/Dynamic-Terms-and-Conditions-based-on-Product-Selection/m-p/14416</description>
|
| 12 |
-
<notes>
|
| 13 |
<authors><author><name>Xiliang Sun</name><user>ryansun</user><email>ryansun81@gmail.com</email></author></authors>
|
| 14 |
-
<date>
|
| 15 |
-
<time>
|
| 16 |
-
<contents><target name="magecommunity"><dir name="TheSunWeb"><dir name="ConditionalTerms"><dir name="Block"><dir name="Adminhtml"><dir name="Checkout"><dir name="Agreement"><dir name="Edit"><file name="Form.php" hash="61bbe9ca3ef2ee3d4361c64a9498ff5d"/></dir></dir></dir></dir><dir name="Checkout"><file name="Agreements.php" hash="0d8d75e7ee146282580e234e1d013149"/></dir></dir><dir name="Model"><dir name="Checkout"><file name="Agreement.php" hash="822ccda2ebbfce8e50144ec24b873ccb"/></dir><file name="Observer.php" hash="22c1e00f8b3b200c0d7f693d34bacd77"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Checkout"><file name="AgreementController.php" hash="91bab32e79934ee59626cb39008726b9"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="
|
| 17 |
<compatible/>
|
| 18 |
-
<dependencies><required><php><min>5.0.0</min><max>
|
| 19 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>TheSunWeb_ConditionalTerms</name>
|
| 4 |
+
<version>1.2.0</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>OSL</license>
|
| 7 |
<channel>community</channel>
|
| 9 |
<summary>Multiple Dynamic Terms and Agreements Management</summary>
|
| 10 |
<description>Allows website to show different agreements and terms base on different products, categories, cart total, shipping address and etc in cart. 
|
| 11 |
Its inspired and requested by https://community.magento.com/t5/Programming-Questions/Dynamic-Terms-and-Conditions-based-on-Product-Selection/m-p/14416</description>
|
| 12 |
+
<notes>Fixed validation bug (alert says selecting all agreements even though all are selected)</notes>
|
| 13 |
<authors><author><name>Xiliang Sun</name><user>ryansun</user><email>ryansun81@gmail.com</email></author></authors>
|
| 14 |
+
<date>2017-02-09</date>
|
| 15 |
+
<time>02:03:58</time>
|
| 16 |
+
<contents><target name="magecommunity"><dir name="TheSunWeb"><dir name="ConditionalTerms"><dir name="Block"><dir name="Adminhtml"><dir name="Checkout"><dir name="Agreement"><dir name="Edit"><file name="Form.php" hash="61bbe9ca3ef2ee3d4361c64a9498ff5d"/></dir></dir></dir></dir><dir name="Checkout"><file name="Agreements.php" hash="0d8d75e7ee146282580e234e1d013149"/></dir></dir><dir name="Helper"><file name="Checkout.php" hash="be5cb1e6ade47de650c8f85125a13948"/><file name="Data.php" hash="07b3069d318dd371edda00ab26e3f0dd"/></dir><dir name="Model"><dir name="Checkout"><file name="Agreement.php" hash="822ccda2ebbfce8e50144ec24b873ccb"/></dir><file name="Observer.php" hash="22c1e00f8b3b200c0d7f693d34bacd77"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Checkout"><file name="AgreementController.php" hash="91bab32e79934ee59626cb39008726b9"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="d07e7144e50f25232d1eb083c93bc03c"/></dir><dir name="sql"><dir name="cterms_setup"><file name="mysql4-install-1.0.0.php" hash="b386db3cf28c5b751b0bf2820b470c45"/><file name="mysql4-upgrade-1.0.0-1.1.0.php" hash="61b9e44c14be303da3a2ddbc7f59985f"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="cterms.xml" hash="812e715879dcf055aa5372b467ffa8b0"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="TheSunWeb_ConditionalTerms.xml" hash="ec90ec8570f461346a013f75c1608747"/></dir></target></contents>
|
| 17 |
<compatible/>
|
| 18 |
+
<dependencies><required><php><min>5.0.0</min><max>7.0.0</max></php></required></dependencies>
|
| 19 |
</package>
|
