The idea is that I’m going to build a website that process purchases to some different stores registered in my website using CodeIgniter. The challenge is coming when I want to display the content of cart only the item from the shop currently viewed by the buyer. I came across to using the cart’s options index for passing the store id so that I can use it to identify from which store the item from.
But I’m not sure how to do it because I don’t know how to select certain cart content based on an identifier like store id. Can anyone give an idea about it? Thank you at advance.
It’s a bit of a hack, but you could add the store_id to the item options.
Then, when looping through your cart contents with foreach, the first line of your loop checks the options and if the store_id doesn’t match – skip the rest of the loop code (with continue;).
Alternatively you could extend the cart class and override the contents() method to do this for you to make your view code a little cleaner.