Jump to content

Where do the cart products come from?


dhobo

Recommended Posts

Seems like a very simple question, but where do the cart products from?

 

In the shopping-cart.tpl template you have the smarty variable $products available, but which class/controller is giving this to the template?

 

I would expect CartController, but I don't see it there

Link to comment
Share on other sites

  • 7 months later...
  • 1 year later...

Try classes/Cart.php  :)

 

it's created/filled in

public function getSummaryDetails($id_lang = null, $refresh = false) :
...
 
$products = $this->getProducts($refresh);             <--- filled here
 
...
 
return array(
'delivery' => $delivery,
'delivery_state' => State::getNameById($delivery->id_state),
'invoice' => $invoice,
'invoice_state' => State::getNameById($invoice->id_state),
'formattedAddresses' => $formatted_addresses,
'products' => array_values($products),               <- there it is... ready to be used in tpl file
'gift_products' => $gift_products,
'discounts' => $cart_rules,
'is_virtual_cart' => (int)$this->isVirtualCart(),
'total_discounts' => $total_discounts,
'total_discounts_tax_exc' => $total_discounts_tax_exc,
'total_wrapping' => $this->getOrderTotal(true, Cart::ONLY_WRAPPING),
'total_wrapping_tax_exc' => $this->getOrderTotal(false, Cart::ONLY_WRAPPING),
'total_shipping' => $total_shipping,
'total_shipping_tax_exc' => $total_shipping_tax_exc,
'total_products_wt' => $total_products_wt,
'total_products' => $total_products,
'total_price' => $base_total_tax_inc,
'total_tax' => $total_tax,
'total_price_without_tax' => $base_total_tax_exc,
'is_multi_address_delivery' => $this->isMultiAddressDelivery() || ((int)Tools::getValue('multi-shipping') == 1),
'free_ship' => $total_shipping ? 0 : 1,
'carrier' => new Carrier($this->id_carrier, $id_lang),
);
...
 
 
 
Hope this helps,
pascal
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...