Lorem Ipsum Posted March 9, 2017 Share Posted March 9, 2017 Hi! I have a module that add a product to cart with a specific price rule so the customer only pay a specific price and not the product price. The plugin is working well, the only thing is, when I create my specific price rule, I redirect the customer to the shopping cart and it displays the product price, not the specific price, I have to refresh after a moments and then only it displays the specific price. There must be a cache somewhere for this but I can't find it... Any idea? Thanks! Link to comment Share on other sites More sharing options...
bollydow Posted August 15, 2018 Share Posted August 15, 2018 Hi, some time has passed since this post was posted, but maybe this problem was solved? Link to comment Share on other sites More sharing options...
abdullacm Posted July 15, 2019 Share Posted July 15, 2019 @bollydow @Lorem Ipsum did you get solved this ? im developing a module that adds specific price dynamically to the products that are in cart, but sometimes the prices are not updating and reflects after few time. Thanks, Link to comment Share on other sites More sharing options...
IronMan0803 Posted July 7, 2020 Share Posted July 7, 2020 (edited) I also encountered this when adding products with a specific price rule. Can someone please help me to resolve this? Thank you! @bollydow @Lorem Ipsum @Abdulla CM Edited July 7, 2020 by IronMan0803 (see edit history) Link to comment Share on other sites More sharing options...
Patryk Tchórzewski Posted February 21, 2021 Share Posted February 21, 2021 (edited) Hello @Abdulla CM, @bollydow, @Lorem Ipsum, @IronMan0803 I have similar problem but I try like code bellow: Cache::clear(); $specific_price->flushCache(); Tools::generateIndex(); DB::getInstance()->execute('RESET QUERY CACHE;'); DB::getInstance()->execute('FLUSH QUERY CACHE;'); $cart->resetStaticCache(); $cart->update(); of course without the success Edited February 22, 2021 by polo195pl (see edit history) Link to comment Share on other sites More sharing options...
Patryk Tchórzewski Posted February 22, 2021 Share Posted February 22, 2021 Well after talk with @Krystian Podemski (thx for help) we found simple solution for this it was enough to change the date from the from field to 0000-00-00 00:00:00 So code for new specific price look now: $specific_price = new SpecificPrice(); $specific_price->id_product = $id_product; // choosen product id $specific_price->id_product_attribute = $id_product_attribute; // optional or set to 0 $specific_price->id_cart = $id_cart; $specific_price->from_quantity = $quantity; $specific_price->price = $price; $specific_price->reduction_type = 'amount'; $specific_price->reduction_tax = 1; $specific_price->reduction = 0; $specific_price->from = date("0000-00-00 00:00:00"); $specific_price->to = date("Y-m-d H:i:s", strtotime('+1 year')); // or set date x days from now $specific_price->id_shop = $id_shop; $specific_price->id_currency = $id_currency; $specific_price->id_country = 0; $specific_price->id_group = 0; $specific_price->id_customer = 0; $specific_price->add(); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now