Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getTotalWeight method not working #192

Open
euge001 opened this issue Mar 26, 2024 · 1 comment
Open

getTotalWeight method not working #192

euge001 opened this issue Mar 26, 2024 · 1 comment
Labels

Comments

@euge001
Copy link

euge001 commented Mar 26, 2024

getTotalWeight method (/var/www/html/ecommerce/plugins/lovata/ordersshopaholic/classes/collection/CartPositionCollection.php) not working same as many others in your very strangely designed application.

At /var/www/html/ecommerce/themes/lovata-shopaholic-sneakers/pages/checkout.htm made: function
onStart()
{
$this['path_page_js'] = mix('js/checkout.js', 'themes/lovata-shopaholic-sneakers/assets');
$this['path_page_css'] = mix('css/checkout.css', 'themes/lovata-shopaholic-sneakers/assets');

$obCartList = \Lovata\OrdersShopaholic\Classes\Collection\CartPositionCollection::make();
$this['totalWeight'] = $obCartList->getTotalWeight();

}

and in I alwayes get 0 whatever real value is.

@kharanenka
Copy link
Contributor

Hello! CartPositionCollection::make() method creates empty collection.
If you user onStart() function, that you can get full cart positions with using Cart component:

onStart()
{
     $obCartList = $this->Cart->get();
    $this['totalWeight'] = $obCartList->getTotalWeight();
}

"Cart" component gets cart_id from cookie and prepare list with cart positions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants