Ich habe ein großes Problem mit PrestaShop, ich benutze eine API von mir selbst, um Service für eine mobile Anwendung bereitzustellen.Produkt in den Warenkorb im bestimmten Shop in Prestashop 1.6 hinzufügen (programmatisch)
Jetzt kann ich hinzufügen, löschen, aktualisieren Menge zu ersten Shop Warenkorb. Ich kann auch zu Kategorien und Unterkategorien wie meinem Online-Shop navigieren.
Aber ich habe zwei Geschäfte und ich möchte ein bestimmtes Produkt im Multishop-Modus zum zweiten Shop hinzufügen, und das Skript wird immer zum ersten Shop-Warenkorb hinzugefügt.
Dies ist meine Zeile, die ich in den Warenkorb legen soll.
erstes Geschäft id = 1
zweiter shop = 4
$_shop = new Shop(_PS_SHOP_SELECTED_ID); //_PS_SHOP_SELECTED_ID = 4
$isAdded = $cart->updateQty((int)$product->quantity, (int)$producToAdd->id, $id_product_attribute, FALSE, 'up', 0,$_shop);
Wie erstellen oder erhalten Sie den $ cart? – sadlyblue
$ context = Kontext :: getContext(); \t \t if (! $ Context-> cart-> id) { \t \t $ context-> cart-> hinzufügen (TRUE, FALSE, TRUE, _PS_SHOP_SELECTED_ID); \t \t $ kontext-> cookie-> id_cart = $ context-> cart-> id; $ cart = neuer Warenkorb ($ context-> cart-> id); $ cart-> id_customer = (int) UserApi :: getIdAuthUser(); $ cart-> id_lang = _PS_APP_MOBILE_LANG_ID; $ cart-> id_currency = (int) Kontext :: getContext() -> Währung-> id; $ cart-> id_carrier = 1; $ cart-> recyclebar = 0; $ cart-> Geschenk = 0; \t} \t $ cart = neuer Warenkorb ($ context-> cart-> id); –
Könnten Sie bitte Ihren Beitrag bearbeiten und weiteren Code hinzufügen? – idnovate