silentRun Posted September 2, 2013 Share Posted September 2, 2013 Hello, I am trying to modify referralprogram to make the "cartRules" created by this module, only compatible with some cartRules... These cartRules are created by PHP, but I don't find the way / method, to tell to the created cartRule, that it is only compatible with certain cartRules.... any help, would be very appreciated. Link to comment Share on other sites More sharing options...
silentRun Posted September 2, 2013 Author Share Posted September 2, 2013 (edited) I did some research and well, there is no method to define cart_rule_combinations I think. What I am doing is execute some query statment function crearReglas(){ $ruleCombin = Db::getInstance()->executeS(' SELECT id_cart_rule FROM `'._DB_PREFIX_.'cart_rule` WHERE (id_cart_rule > 18) AND (id_cart_rule != 31) '); $cartRule=31; foreach ($ruleCombin as $existingCartRule) { $insertData = array( 'id_cart_rule_1' => $cartRule, 'id_cart_rule_2' => (int)$existingCartRule[id_cart_rule] ); //echo "añadida regla para cartRule: ".$existingCartRule[id_cart_rule]."<br/>"; Db::getInstance()->insert("cart_rule_combination", $insertData); } } I I run this code from a external php file on the root on the prestashop, and runs fine. However, If i try to execute this code directly on the "ReferralProgramModule.php": $ruleCombin = Db::getInstance()->executeS(' SELECT id_cart_rule FROM `'._DB_PREFIX_.'cart_rule` WHERE (id_cart_rule > 18)'); $cartRule22=31; foreach ($ruleCombin as $existingCartRule) { $insertData = array( 'id_cart_rule_1' => $cartRule22, 'id_cart_rule_2' => (int)$existingCartRule[id_cart_rule] ); //echo "añadida regla para cartrule: ".$existingCartRule[id_cart_rule]."<br/>"; Db::getInstance()->insert("cart_rule_combination", $insertData); } Don't for why reason, but the code is not executed... is there any way to check what happends ? which is the error? thanks in advance Edited September 2, 2013 by silentRun (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts