Hello Team,
$oxcmp_basket, a Smarty variable to be found in a template, basketcontents.tpl.
I studied some code, my assumption was $oxcmp_basket its values are taken from session. This variable, it plays a major role in displaying prices of items and basket price calculation.
My question is $oxcmp_basket, how does it produce or obtain its values?
Thank you.
choose your shopversion to get the docu about source code:
Components work like this: the return value of “render” method is passed to smarty with the name of the component. In this case:
Component: oxcmp_basket.php, its render method:
public function render()
{
// recalculating
if ( $oBasket = $this->getSession()->getBasket() ) {
$oBasket->calculateBasket( false );
}
parent::render();
return $oBasket;
}
If you follow this path in the end $oBasket is an oxbasket object. So to answer your question $oxcmp_basket is an instance of oxbasket and it is stored in session.
Thank you Ray for the link of the OXID Docu, it’s very useful.
Frank, thank you so much for your explanation about the components.
At first i was’t sure how the components work, e.g. the class name oxcmp_basket and the Smarty variable $oxcmp_basket which locates in a template, I was wondering whether they refer to each other or not. so now i know the meaning of it, yay!.