Jump to content


  • Posts

  • Joined

  • Last visited

Profile Information

  • Location
  • Activity

Recent Profile Visitors

219 profile views

AlainGau's Achievements


Newbie (1/14)




Community Answers

  1. Looks like product prices can be change in ~3 ways: 1. price rule 2. cart rule 3. direct pricing change on product catalog The rules can change a product price on specific time (date + time). As far as I can see there is no hook that get executed when the price of the product, that is in a cart, get changed (up or down) from the 3 above options (and other if exist). Where in the core I could add a custom hook to fire some custom logic when the price of a product that is in a cart get changed? I understand that would imply some overrides. in Cart.php, CartRule.php, SpecificPrice.php, SpecificPriceRule.php, other?? thanks
  2. I am creating a new cart and simply add a product in that newly created cart, but the product get added to the cart that was created before not to the newly created, why? I dont want to use the context cart, it is more like a backend process that has nothing to do with a front-end user interaction. Adding $cart->update does not solve it. include('../../config/config.inc.php'); include('../../init.php'); $cart = new Cart(); $cart->id_customer = 1; $cart->id_address_delivery = (int) (Address::getFirstCustomerAddressId($cart->id_customer)); $cart->id_address_invoice = $cart->id_address_delivery; $cart->id_lang = 1; $cart->id_currency = 2; $cart->id_carrier = 1; $cart->recyclable = 0; $cart->gift = 0; $cart->add(); $cookie->id_cart = (int)($cart->id); $cart->updateQty(1, 4); //add one unit of product id 4
  3. thanks but it was my path accesses that were wrong: include(dirname(__FILE__).'../../config/config.inc.php'); include(dirname(__FILE__).'../../init.php'); include(dirname(__FILE__).'../../classes/Cookie.php'); should be as below to work, since I am in the modules/mymodule folders.. include('../../config/config.inc.php'); include('../../init.php'); include('../../classes/Cookie.php');
  4. ok it works, I path where wrong, from module folder should be: include('../../config/config.inc.php'); include('../../init.php'); include('../../classes/Cookie.php');
  5. I have the below PHP file in my module folder that is call with an ajax post (jquery from UI). And I am getting the following error: Class 'Context' not found in ... when I trigger the POST I am running PS 1.6, how can I access the context from this file?? <?php define('_EXTERNAL_SCRIPT_', 'true'); include(dirname(__FILE__).'../../config/config.inc.php'); include(dirname(__FILE__).'../../init.php'); include(dirname(__FILE__).'../../classes/Cookie.php'); Context::getContext()->cookie->__set('myData', $_POST['data1']); ?>
  6. Hi hi Cotoko, I does not recognize the context, I am getting the following error: Class 'Context' not found in <b>/presta/modules/mymodule/setParam.php What am I missing to get the context? I have included the config, init and cookies.... I am running PS 1.6
  7. I created a module with a hook on hookActionCartSave, which work very well. Then I created a simple php file in same folder has my module that listent to a POST and I try to save a parameter value in global variable that my hook could get back once the use add something to the cart (i.e. tirgger hookActionCartSave). 1. My new file (setParam.php) has the following very simple code, it takes the POST parameter 'param1' and put his value in superglobal $_ENV , var_dump($_ENV["param1"]); show me that it sets it correctly. <?php define('_EXTERNAL_SCRIPT_', 'true'); include(dirname(__FILE__).'../../config/config.inc.php'); include(dirname(__FILE__).'../../init.php'); include(dirname(__FILE__).'../../classes/Cookie.php'); $_ENV["param1"] = $_POST['param1']; var_dump($_ENV["param1"]); ?> 2. But then I my module $_ENV is always empty, it seems that $_ENV is not shared or ...?? ... function hookActionCartSave($params) { var_dump($_ENV["param1"]); } ... I tried with $_COOKIE, $GLOBALS, $_SESSION and I not able to add value to global context from my setParam.php file. Any idea how I can add value to the current session context from a standalone file that receive a post from the UI (jquery ajax post)? Thanks - Alain
  • Create New...