Psytanium Posted August 22, 2020 Share Posted August 22, 2020 Hi, In shopping_cart.php class, i can find $this->contents[$products_id]['qty'], but where did it get its value ? possible to create $this->contents[$products_id]['price'] ? Thank you Link to comment Share on other sites More sharing options...
♥ecartz Posted August 23, 2020 Share Posted August 23, 2020 It's inadvisable to add more columns to cart->contents, as it is stored in the session. That's why price and other characteristics are loaded by get_products rather than stored in the cart. If you are making custom attributes, consider changing the products ID. That's how that has typically been implemented in the past. Or consider doing something like product bundles where the user sees one product but behind the scenes there is more than one. The quantity is set in includes/actions. Always back up before making changes. Link to comment Share on other sites More sharing options...
Psytanium Posted August 23, 2020 Author Share Posted August 23, 2020 11 hours ago, ecartz said: It's inadvisable to add more columns to cart->contents, as it is stored in the session. That's why price and other characteristics are loaded by get_products rather than stored in the cart. If you are making custom attributes, consider changing the products ID. That's how that has typically been implemented in the past. Or consider doing something like product bundles where the user sees one product but behind the scenes there is more than one. The quantity is set in includes/actions. Thank you for explaining this issue, in the file i want to modify this function : function count_contents() { // get total number of items in cart $total_items = 0; if (is_array($this->contents)) { reset($this->contents); while (list($products_id, ) = each($this->contents)) { $total_items += $this->get_quantity($products_id); } } For some reasons, i want to count specific file and do something similar to function count_contents() { // get total number of items in cart $total_items = 0; if (is_array($this->contents)) { reset($this->contents); while (list($products_id, ) = each($this->contents)) { // modification to count specific products if ($this->contents[$products_id]['newfield'] == 1) { $total_items += $this->get_quantity($products_id); } } } any possible solution ? thanks btw i didn't find includes/action in my directories, i'm working on 2.3.4 Link to comment Share on other sites More sharing options...
Psytanium Posted August 26, 2020 Author Share Posted August 26, 2020 Any solution please to split the cart content in shopping cart ? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.