[email protected]
Members-
Posts
29 -
Joined
-
Last visited
[email protected]'s Achievements
Newbie (1/14)
5
Reputation
-
Hi, I have a script which is changing order status from external program^ but it is changing order status directly in the database. Can somebody help me to change the script in order to use native Prestashop status change? Here is my code: <? ini_set('error_reporting', E_ALL); ini_set('display_errors', 1); ini_set('display_startup_errors', 1); include(dirname(__FILE__).'/config/config.inc.php'); $result = Db::getInstance()->executeS('SELECT * FROM '._DB_PREFIX_.'orders where date_add >= now() - INTERVAL 24 HOUR;'); if(isset($result) && !empty($result)){ foreach($result as $item){ if((int)$item['current_state']==5){continue;} $url=" XXXXXXXXX". "idOrder=".$item['shipping_number']. "&user=test". "&password=123456". "&cid=4541"; $mych = curl_init(); curl_setopt($mych, CURLOPT_URL, $url); curl_setopt($mych, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($mych, CURLOPT_HEADER, 0); $data = curl_exec($mych); curl_close($mych); /* echo "<pre>"; print_r($data); echo "</pre>";*/ $rez=""; if(isset($data) && !empty($data) && $data != 'null' ){ $rez = json_decode($data, true); switch ((int)$rez['status']){ case 3: Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'orders SET current_state = 1 WHERE shipping_number = '.$item["shipping_number"]); break; case 4: Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'orders SET current_state = 1 WHERE shipping_number = '.$item["shipping_number"]); break; case 5: Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'orders SET current_state = 1 WHERE shipping_number = '.$item["shipping_number"]); break; case 6: Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'orders SET current_state = 1 WHERE shipping_number = '.$item["shipping_number"]); break; case 7: Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'orders SET current_state = 1 WHERE shipping_number = '.$item["shipping_number"]); break; case 8: Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'orders SET current_state = 4 WHERE shipping_number = '.$item["shipping_number"]); break; default: Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'orders SET current_state = 3 WHERE shipping_number = '.$item["shipping_number"]); } }else{ /*Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'orders` SET `current_state` = 5 WHERE `shipping_number` = '.$item["shipping_number"]);*/ } } } echo 1; ?> Regards Suren
-
[SOLVED] Show Product Reference in categories
[email protected] replied to RCP90's topic in Configuring and using PrestaShop
Can you help to show product weight on category page. I try to insert following {sprintf("%1\$u",$product->weight)} but it shows 0 (zero) while on product page this code works. PS: I use 1.5.4 -
30ml started following [email protected]
-
Same question. Any help?
-
[SOLVED] Price Rules depending on time
[email protected] replied to [email protected]'s topic in Core developers
Hi, Pascal! I moved file SetCartRule.php to parent directory and now everything works. Thank you very much for you support! Regards -
[SOLVED] Price Rules depending on time
[email protected] replied to [email protected]'s topic in Core developers
This I get from console: root@pushpizza:~# /usr/bin/wget -O /dev/null -t 1 http://pushpizza.ru/config/SetCartRuleTime.php --2014-02-01 16:34:00-- http://pushpizza.ru/config/SetCartRuleTime.php Resolving pushpizza.ru (pushpizza.ru)... 78.24.221.120 Connecting to pushpizza.ru (pushpizza.ru)|78.24.221.120|:80... connected. HTTP request sent, awaiting response... 403 Forbidden 2014-02-01 16:34:00 ERROR 403: Forbidden. Regards Suren -
[SOLVED] Price Rules depending on time
[email protected] replied to [email protected]'s topic in Core developers
Hi, Pascal Yes I run command under root. /usr/bin/wget -O /dev/null -t 1 http://pushpizza.ru/config/SetCartRuleTime.php Regards Suren -
[SOLVED] Price Rules depending on time
[email protected] replied to [email protected]'s topic in Core developers
Hi Pascal! I made everything like you wrote but it doesn't work. When I run cron job it gives me: Exited with return code = 8 and doesn't change my cart rule. My file looks like: <?php // cron job php script to set shop into maintenance mode // by Pascal van Geest @ ModulesModules.com // use with cron job string like this: // //Setup connection variables, such as database username //and password $hostname="localhost"; $dbname="***"; $username="***"; $password="***"; //Connect to the database $connection = mysql_connect($hostname, $username, $password); mysql_select_db($dbname, $connection); //Setup our query $query = "UPDATE `ps_cart_rule` SET `date_from`=CURDATE() + INTERVAL 10 HOUR, `date_to`= CURDATE() + INTERVAL 16 HOUR WHERE `id_cart_rule` = 167;"; //Run the Query $result = mysql_query($query); ?> What to do? Regards -
[SOLVED] Price Rules depending on time
[email protected] replied to [email protected]'s topic in Core developers
Thanks, Pascal! I'll try it and will get you know if it works. -
[SOLVED] Price Rules depending on time
[email protected] replied to [email protected]'s topic in Core developers
What script do I need to put in cron? Can somebody help? -
How to create price rules depending on time? I need to give X% discount on some categories starting 13:00 till 16:00 for example.