Sub tota coming zero

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
adityabanerjee
Posts: 44
Joined: 05 Oct 2019, 06:42

Sub tota coming zero

Post by adityabanerjee » 28 Feb 2022, 09:01

Hi Aimeos,

We see that when the delivery status is 2 then our subtotal $basket->getPrice()->getValue() is coming zero for us.

Please assist.

nos3
Posts: 89
Joined: 01 Sep 2015, 13:26

Re: Sub tota coming zero

Post by nos3 » 01 Mar 2022, 09:00

This isn't the default behaviour.

adityabanerjee
Posts: 44
Joined: 05 Oct 2019, 06:42

Re: Sub tota coming zero

Post by adityabanerjee » 09 Mar 2022, 09:31

Please assist. What could be the reason?

User avatar
aimeos
Administrator
Posts: 7895
Joined: 01 Jan 1970, 00:00

Re: Sub tota coming zero

Post by aimeos » 11 Mar 2022, 07:14

Please post your custom code, probable there's somewhere a problem.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

adityabanerjee
Posts: 44
Joined: 05 Oct 2019, 06:42

Re: Sub tota coming zero

Post by adityabanerjee » 16 Mar 2022, 10:47

<?php

/**
* @license LGPLv3, https://opensource.org/licenses/LGPL-3.0
* @copyright Metaways Infosystems GmbH, 2011
* @copyright Aimeos (aimeos.org), 2015-2021
* @package MShop
* @subpackage Order
*/


namespace Aimeos\MShop\Order\Item\Base;


/**
* Default implementation of the shopping basket.
*
* @package MShop
* @subpackage Order
*/
class EbdaaOrderItemBase extends Standard
{
/**
* Returns a price item with amounts calculated for the products, costs, etc.
*
* @return \Aimeos\MShop\Price\Item\Iface Price item with price, costs and rebate the customer has to pay
*/
public function getPrice() : \Aimeos\MShop\Price\Item\Iface
{
if( $this->recalc )
{
$price = $this->price->clear();

foreach( $this->getServices() as $list )
{
foreach( $list as $service ) {
$price = $price->addItem( $service->getPrice() );
}
}

foreach( $this->getProducts() as $product ) {
// 0=deleted, 1=cancelled
if( !in_array( $product->getStatus(), [0, 1] ) ) {
$price = $price->addItem( $product->getPrice(),
$product->getQuantity() );
}
}

$this->price = $price;
$this->recalc = false;
}

return $this->price;
}

}
Is this has to do something with it?

User avatar
aimeos
Administrator
Posts: 7895
Joined: 01 Jan 1970, 00:00

Re: Sub tota coming zero

Post by aimeos » 18 Mar 2022, 07:57

Does it work if you remove your "if( !in_array( $product->getStatus(), [0, 1] ) )" again?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

adityabanerjee
Posts: 44
Joined: 05 Oct 2019, 06:42

Re: Sub tota coming zero

Post by adityabanerjee » 22 Mar 2022, 13:16

No, I think the issue still persist.

User avatar
aimeos
Administrator
Posts: 7895
Joined: 01 Jan 1970, 00:00

Re: Sub tota coming zero

Post by aimeos » 24 Mar 2022, 09:12

Remove other custom code until it works again as this behavior is not standard.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply