PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, June 30, 2022

[FIXED] how to get cart content of second shop in prestashop

 June 30, 2022     php, prestashop, prestashop-1.7, prestashop-modules     No comments   

Issue

I have a multistore enable in my Prestashop, I would like to access the cart of the second shop in the first shop. How can I achieve this?

I can get the content of the cart in the current shop using the code below:

$this->context->cart

but how to access the cart of the second shop which is not in the current context


Solution

I think this is not possible with Prestashop classes / methods as Context object is related to the current shop.

Isn't using the built-in shared carts between the same shop group a chance ? I know it's buggy, but it should work as long the two shops are in the same domain.

Otherwise I think you can perform a DB query directly on the ps_cart_product table (maybe joined with ps_cart to retrieve the id_customer) since it contains the id_shop row.



Answered By - user3256843
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing