Jump to content

Prestashop custom admin controler add product to customer cart and reflecting on front end


kacloudy

Recommended Posts

Hi everyone. I have a Book list module where clients can upload the type of book they want. and admin will map the books according to the product.My only problem occurs when i try to create a cart for the customer using their id . but on login the cart is not displayed on the users side. Below is my cart snippet

 


            $customer = new Customer($lists[0]['customerId']);

            $cart = new Cart();
            $cart->id_customer = (int)$lists[0]['customerId'];
            $cart->id_address_delivery = (int)  (Address::getFirstCustomerAddressId($lists[0]['customerId']));
            $cart->id_address_invoice = $cart->id_address_delivery;
            $cart->id_lang = (int)Configuration::get('PS_LANG_DEFAULT');
            $cart->id_currency = (int)Configuration::get('PS_CURRENCY_DEFAULT');
            $cart->id_carrier = 1;
            $cart->recyclable = 0;
            $cart->gift = 0;
            $cart->add();


            $cart->updateQty(
                1,
                271,
                $id_product_attribute = null,
                $id_customization = false,
                $operator = 'up',
                $id_address_delivery = 0,
                $shop = null,
                $auto_add_cart_rule = true
                );

 

Any help will be appreciated

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...