Zen Follower
- Join Date:
- Jun 2012
- Posts:
- 481
- Plugin Contributions:
- 0
How to refresh shopping cart page?
I have a requirement to prohibit a certain group of customers from purchasing one or more specific products. I've seen the add-on which effectively hides the category and/or products from a specified customer group. But I have had problems setting up a development branch to integrate the add-on. So I decided to work on an extra cart action that removes the prohibited products from a customers cart and displays a message on the shopping cart page telling them that the product(s) will not be added to the cart. The shopping cart page should remain displayed with the prohibited products not displayed in the cart, and with updated subtotal price.
I have used the shopping cart class method "remove(product_id)" and while notifier trace tells me that the remove method is executed for the prohibited products, and the warning message is displayed, the products remain displayed on the shopping cart page when multiple prohibited products are selected from the product listing page. There are no php errors logged. I think that, even though the products have been removed, the page display has not been updated to reflect the current cart contents. How can I refresh the shopping cart display? I'll admit there could be reasons for the problem other than no cart refresh. The code to call the remove method is:
$_SESSION['cart']->remove($pid);
Anyone's help is greatly appreciated!
Dave
zc155f, php7.1.x, heavy customization