Jump to content


  • Posts

  • Joined

  • Last visited

Profile Information

  • Activity
    Project Owner

luizlaf's Achievements


Newbie (1/14)



  1. Prestashop standard 1 multi store system 1 employee for each store Requirements: Due to privacy concerns, customer information is only available (customer is created under the store) when adding a product to cart in that store. Visualize all carts/orders from all stores. My proposed approach: A system wise table with a master-customer information and the id_customer for each store. A single entry point to the system, where I ensure master-customer is created and logged in. When customer clicks on add-to-cart button, check on master-customer table if customer exists on that store, if yes- automatic login to the store, if not- create a customer in that store, add reference to the master-customer table and automatically login customer. Now that the customer is logged in, the cart can be created (or retrieved) for that customer specifically. My progress so far: Master-customer table is created and user logs in fine. Product page is displayed (store-wise customer is not logged in yet) When customer clicks on add-to-cart I need to check and create customer in that store. Under function assignContentVars($params) of blockcart.php Check from master-customer, assuming the customer exists in that store already (returns id_customer for that shop) $customer = new Customer((int)$result[0]['id_cust_shop']); Context::getContext()->customer = $customer; Context::getContext()->customer->logged = true; Rest of the function... The cart is being created, but the customer information is not being inserted (as if the customer is not logged in). if I insert the code below just before the end of the function: $this->context->cart->id_customer = (int)$customer->id; $this->context->cart->secure_key = $customer->secure_key; $this->context->cart->save(); The cart is created with the correct customer information, but somehow 3 carts are created... Questions: Any better approach to achieve this? Is the code I produced in the right place (function assignContentVars($params))? Am I doing the right automatic login (apparently not, even though when I check $customer->isLogged() returns true) Why is the cart not initially created with the id_customer, and with the 2nd session of the code I get multiple creations? Thanks for the help!
  • Create New...