Set a custom price for a product when added to cart
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!
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
- EmanueleFantin
- Posts: 5
- Joined: 20 Aug 2024, 09:34
Set a custom price for a product when added to cart
Hi, I created a "custom sticker" product that has several attributes (color, font, size) that contribute to the price calculation.
So for example a 20x50 cm product costs €10
a 30x70 product costs €12.
I then created a plugin that is called at the addProduct.before event, here is the simple code:
The code works and sets the correct price.

But if I create a second sticker that has a different cost, it sets the same price to all the products.

Does anyone know how I could solve this problem? Maybe I don't have to use a plugin but do something else?
Thanks to everyone in advance
So for example a 20x50 cm product costs €10
a 30x70 product costs €12.
I then created a plugin that is called at the addProduct.before event, here is the simple code:
Code: Select all
<?php
namespace Aimeos\MShop\Plugin\Provider\Order;
use Illuminate\Support\Facades\Config;
class CalcPriceAdesivi
extends \Aimeos\MShop\Plugin\Provider\Factory\Base
implements \Aimeos\MShop\Plugin\Provider\Iface, \Aimeos\MShop\Plugin\Provider\Factory\Iface
{
public function register(\Aimeos\MShop\Order\Item\Iface $p): \Aimeos\MShop\Plugin\Provider\Iface
{
$plugin = $this->object();
$p->attach($plugin, 'addProduct.before');
return $this;
}
public function update(\Aimeos\MShop\Order\Item\Iface $p, string $action, $value = null)
{
$num_prodotti = count($p->getProducts()->toArray());
if ($value['order.product.prodcode'] == Config::get('shop.adesivi.product_name')) {
$price = $value->getPrice();
$price->setValue(....FORMULA FOR CALCULATE THE PRICE.....);
$value->setPrice($price);
}
return $value;
}
}

But if I create a second sticker that has a different cost, it sets the same price to all the products.

Does anyone know how I could solve this problem? Maybe I don't have to use a plugin but do something else?
Thanks to everyone in advance
Re: Set a custom price for a product when added to cart
Use configurable attributes which can have own prices that add up to the total price of the product when selected. Thus, you don't need a basket plugin for custom calculation.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

- EmanueleFantin
- Posts: 5
- Joined: 20 Aug 2024, 09:34
Re: Set a custom price for a product when added to cart
The thing is that the price depends on a calculation made by the software based on the area of the sticker (which in turn depends on the font and the length of the written text).

So I don't have a parameter that determines the price based on something chosen by the user (such as the size of a shirt).
The price must be a hidden field or set when adding to the cart, so that the user cannot change it.
Is this possible with configurable attributes? I can't find it in the documentation...

So I don't have a parameter that determines the price based on something chosen by the user (such as the size of a shirt).
The price must be a hidden field or set when adding to the cart, so that the user cannot change it.
Is this possible with configurable attributes? I can't find it in the documentation...
Re: Set a custom price for a product when added to cart
In that case, the basket plugin is the only option. You have to calculate the price based on the attributes of each product.
Also, don't mix Laravel and Aimeos code in basket plugins. You can configure the product code the plugin should use in the plugin config itself.
Also, don't mix Laravel and Aimeos code in basket plugins. You can configure the product code the plugin should use in the plugin config itself.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

- EmanueleFantin
- Posts: 5
- Joined: 20 Aug 2024, 09:34
Re: Set a custom price for a product when added to cart
Thanks for the advice not to mix the code, I will fix it later.
The problem is that the price I calculate is applied to ALL the products of the same type that are in the cart.
I am trying to apply it only to the last insert, but it does not work:
Any advice?
The problem is that the price I calculate is applied to ALL the products of the same type that are in the cart.
I am trying to apply it only to the last insert, but it does not work:
Code: Select all
public function update(\Aimeos\MShop\Order\Item\Iface $p, string $action, $value = null)
{
//count products in basket
$num_prodotti = count($p->getProducts()->toArray());
//iterate products in basket
foreach ($p->getProducts() as $key => $item_product) {
//IF IT'S THE LAST PRODUCT ADDED I CHANGE THE PRICE
if($key == ($num_prodotti-1)){
if ($value['order.product.prodcode'] == Config::get('shop.adesivi.product_name')) {
$price = $value->getPrice();
$price->setValue(11);
$value->setPrice($price);
}
}
}
return $value;
}
Any advice?
Re: Set a custom price for a product when added to cart
Update the price only for the order product contained in $value and don't loop over all order products
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

- EmanueleFantin
- Posts: 5
- Joined: 20 Aug 2024, 09:34
Re: Set a custom price for a product when added to cart
Hi, it was the original solution, but it gives me the same result.
I made a video: as you can see the first product costs €14.64.
The second is modified and changes the price to €12.26.
But when I add it, both prices are modified!
It's as if Aimeos somewhere (I don't know where) set the modification to all products of the same type, and not just to the specific item in the cart.
https://www.emanuelefantin.it/assets/tmp/videonk.mp4
This thing is driving me crazy!
Code: Select all
public function update(\Aimeos\MShop\Order\Item\Iface $p, string $action, $value = null)
{
if ($value['order.product.prodcode'] == Config::get('shop.adesivi.product_name')) {
$price = $value->getPrice();
$price->setValue(12.26);
$value->setPrice($price);
Log::debug(print_r($value, true));
}
return $value;
}
The second is modified and changes the price to €12.26.
But when I add it, both prices are modified!
It's as if Aimeos somewhere (I don't know where) set the modification to all products of the same type, and not just to the specific item in the cart.
https://www.emanuelefantin.it/assets/tmp/videonk.mp4
This thing is driving me crazy!

Re: Set a custom price for a product when added to cart
What is the output of the logging in your basket plugin?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

- EmanueleFantin
- Posts: 5
- Joined: 20 Aug 2024, 09:34
Re: Set a custom price for a product when added to cart
First product added (14.64 €):
Log after second product added (13.21 €):
After second as always I have both products in cart at 13,21 €
Log after second product added (13.21 €):
Code: Select all
[2024-08-25 10:33:09] local.DEBUG: Aimeos\MShop\Order\Item\Product\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.siteid] => 1.
[last_google_update] =>
[order.product.prodcode] => adesivo-custom
[order.product.productid] => 50621
[order.product.type] => default
[order.product.scale] => 1
[order.product.target] => adesivi.builder
[order.product.name] => Scritta adesiva personalizzata
[order.product.mediaurl] => 1.d/product/b/2/b27568da_06840c86_file-name-53.webp?v=20240813141403
[order.product.vendor] => NautiKing
[order.product.quantity] => 1
[order.product.stocktype] => default
[order.product.timeframe] =>
)
[products:Aimeos\MShop\Order\Item\Product\Base:private] => Array
(
)
[attributes:Aimeos\MShop\Order\Item\Product\Base:private] => Array
(
[0] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 30
[order.product.attribute.name] => Colore
[order.product.attribute.code] => text
[order.product.attribute.value] => blue
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
[1] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 31
[order.product.attribute.name] => Font
[order.product.attribute.code] => text
[order.product.attribute.value] => caramel
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
[2] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 32
[order.product.attribute.name] => Testo
[order.product.attribute.code] => text
[order.product.attribute.value] => RM 012345 X
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
[3] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 33
[order.product.attribute.name] => Altezza
[order.product.attribute.code] => text
[order.product.attribute.value] => 20
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
[4] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 34
[order.product.attribute.name] => Dimensione
[order.product.attribute.code] => text
[order.product.attribute.value] => 79x20cm
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
[5] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 35
[order.product.attribute.name] => UUID
[order.product.attribute.code] => text
[order.product.attribute.value] => 1724581984.007
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
)
[attributesMap:Aimeos\MShop\Order\Item\Product\Base:private] => Array
(
[custom] => Array
(
[text] => Array
(
[30] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 30
[order.product.attribute.name] => Colore
[order.product.attribute.code] => text
[order.product.attribute.value] => blue
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
[31] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 31
[order.product.attribute.name] => Font
[order.product.attribute.code] => text
[order.product.attribute.value] => caramel
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
[32] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 32
[order.product.attribute.name] => Testo
[order.product.attribute.code] => text
[order.product.attribute.value] => RM 012345 X
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
[33] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 33
[order.product.attribute.name] => Altezza
[order.product.attribute.code] => text
[order.product.attribute.value] => 20
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
[34] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 34
[order.product.attribute.name] => Dimensione
[order.product.attribute.code] => text
[order.product.attribute.value] => 79x20cm
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
[35] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 35
[order.product.attribute.name] => UUID
[order.product.attribute.code] => text
[order.product.attribute.value] => 1724581984.007
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
)
)
)
[price:Aimeos\MShop\Order\Item\Product\Base:private] => Aimeos\MShop\Price\Item\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => price.
[type:protected] =>
[bdata:protected] => Array
(
[price.id] => 50649
[price.siteid] => 1.
[price.type] => default
[price.currencyid] => EUR
[price.domain] => product
[price.label] =>
[price.quantity] => 1
[price.value] => 13.21
[price.costs] => 0.00
[price.rebate] => 0.00
[price.taxrate] => {"tax":"22.00"}
[price.status] => 1
[price.mtime] => 2024-08-22 14:35:24
[price.ctime] => 2024-08-22 14:13:06
[price.editor] => fantin.emanuele@gmail.com
[price.taxrates] => Array
(
[tax] => 22.00
)
[.currencyid] => EUR
[.precision] => 2
[price.taxflag] => 1
)
[precision:Aimeos\MShop\Price\Item\Base:private] => 2
[listPrepared:Aimeos\MShop\Price\Item\Base:private] =>
[listItems:Aimeos\MShop\Price\Item\Base:private] => Array
(
)
[listRefItems:Aimeos\MShop\Price\Item\Base:private] => Array
(
)
[listRmItems:Aimeos\MShop\Price\Item\Base:private] => Array
(
)
[listRmMap:Aimeos\MShop\Price\Item\Base:private] => Array
(
)
[listMap:Aimeos\MShop\Price\Item\Base:private] => Array
(
)
[listMax:Aimeos\MShop\Price\Item\Base:private] => 0
[propItems:Aimeos\MShop\Price\Item\Base:private] => Array
(
)
[propRmItems:Aimeos\MShop\Price\Item\Base:private] => Array
(
)
[propMax:Aimeos\MShop\Price\Item\Base:private] => 0
[currencyid:Aimeos\MShop\Price\Item\Standard:private] => EUR
[tax:Aimeos\MShop\Price\Item\Standard:private] =>
)
)
[2024-08-25 10:33:09] local.DEBUG: Aimeos\MShop\Order\Item\Product\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.siteid] => 1.
[last_google_update] =>
[order.product.prodcode] => adesivo-custom
[order.product.productid] => 50621
[order.product.type] => default
[order.product.scale] => 1
[order.product.target] => adesivi.builder
[order.product.name] => Scritta adesiva personalizzata
[order.product.mediaurl] => 1.d/product/b/2/b27568da_06840c86_file-name-53.webp?v=20240813141403
[order.product.vendor] => NautiKing
[order.product.quantity] => 1
[order.product.stocktype] => default
[order.product.timeframe] =>
)
[products:Aimeos\MShop\Order\Item\Product\Base:private] => Array
(
)
[attributes:Aimeos\MShop\Order\Item\Product\Base:private] => Array
(
[0] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 30
[order.product.attribute.name] => Colore
[order.product.attribute.code] => text
[order.product.attribute.value] => blue
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
[1] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 31
[order.product.attribute.name] => Font
[order.product.attribute.code] => text
[order.product.attribute.value] => arial
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
[2] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 32
[order.product.attribute.name] => Testo
[order.product.attribute.code] => text
[order.product.attribute.value] => RM 012345 X
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
[3] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 33
[order.product.attribute.name] => Altezza
[order.product.attribute.code] => text
[order.product.attribute.value] => 20
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
[4] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 34
[order.product.attribute.name] => Dimensione
[order.product.attribute.code] => text
[order.product.attribute.value] => 130x20cm
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
[5] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 35
[order.product.attribute.name] => UUID
[order.product.attribute.code] => text
[order.product.attribute.value] => 1724581894.823
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
)
[attributesMap:Aimeos\MShop\Order\Item\Product\Base:private] => Array
(
[custom] => Array
(
[text] => Array
(
[30] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 30
[order.product.attribute.name] => Colore
[order.product.attribute.code] => text
[order.product.attribute.value] => blue
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
[31] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 31
[order.product.attribute.name] => Font
[order.product.attribute.code] => text
[order.product.attribute.value] => arial
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
[32] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 32
[order.product.attribute.name] => Testo
[order.product.attribute.code] => text
[order.product.attribute.value] => RM 012345 X
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
[33] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 33
[order.product.attribute.name] => Altezza
[order.product.attribute.code] => text
[order.product.attribute.value] => 20
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
[34] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 34
[order.product.attribute.name] => Dimensione
[order.product.attribute.code] => text
[order.product.attribute.value] => 130x20cm
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
[35] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 35
[order.product.attribute.name] => UUID
[order.product.attribute.code] => text
[order.product.attribute.value] => 1724581894.823
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
)
)
)
[price:Aimeos\MShop\Order\Item\Product\Base:private] => Aimeos\MShop\Price\Item\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => price.
[type:protected] =>
[bdata:protected] => Array
(
[price.id] => 50649
[price.siteid] => 1.
[price.type] => default
[price.currencyid] => EUR
[price.domain] => product
[price.label] =>
[price.quantity] => 1
[price.value] => 13.21
[price.costs] => 0.00
[price.rebate] => 0.00
[price.taxrate] => {"tax":"22.00"}
[price.status] => 1
[price.mtime] => 2024-08-22 14:35:24
[price.ctime] => 2024-08-22 14:13:06
[price.editor] => fantin.emanuele@gmail.com
[price.taxrates] => Array
(
[tax] => 22.00
)
[.currencyid] => EUR
[.precision] => 2
[price.taxflag] => 1
)
[precision:Aimeos\MShop\Price\Item\Base:private] => 2
[listPrepared:Aimeos\MShop\Price\Item\Base:private] =>
[listItems:Aimeos\MShop\Price\Item\Base:private] => Array
(
)
[listRefItems:Aimeos\MShop\Price\Item\Base:private] => Array
(
)
[listRmItems:Aimeos\MShop\Price\Item\Base:private] => Array
(
)
[listRmMap:Aimeos\MShop\Price\Item\Base:private] => Array
(
)
[listMap:Aimeos\MShop\Price\Item\Base:private] => Array
(
)
[listMax:Aimeos\MShop\Price\Item\Base:private] => 0
[propItems:Aimeos\MShop\Price\Item\Base:private] => Array
(
)
[propRmItems:Aimeos\MShop\Price\Item\Base:private] => Array
(
)
[propMax:Aimeos\MShop\Price\Item\Base:private] => 0
[currencyid:Aimeos\MShop\Price\Item\Standard:private] => EUR
[tax:Aimeos\MShop\Price\Item\Standard:private] =>
)
)
[2024-08-25 10:33:09] local.DEBUG: Aimeos\MShop\Order\Item\Product\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.siteid] => 1.
[last_google_update] =>
[order.product.prodcode] => adesivo-custom
[order.product.productid] => 50621
[order.product.type] => default
[order.product.scale] => 1
[order.product.target] => adesivi.builder
[order.product.name] => Scritta adesiva personalizzata
[order.product.mediaurl] => 1.d/product/b/2/b27568da_06840c86_file-name-53.webp?v=20240813141403
[order.product.vendor] => NautiKing
[order.product.quantity] => 1
[order.product.stocktype] => default
[order.product.timeframe] =>
)
[products:Aimeos\MShop\Order\Item\Product\Base:private] => Array
(
)
[attributes:Aimeos\MShop\Order\Item\Product\Base:private] => Array
(
[0] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 30
[order.product.attribute.name] => Colore
[order.product.attribute.code] => text
[order.product.attribute.value] => blue
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
[1] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 31
[order.product.attribute.name] => Font
[order.product.attribute.code] => text
[order.product.attribute.value] => caramel
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
[2] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 32
[order.product.attribute.name] => Testo
[order.product.attribute.code] => text
[order.product.attribute.value] => RM 012345 X
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
[3] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 33
[order.product.attribute.name] => Altezza
[order.product.attribute.code] => text
[order.product.attribute.value] => 20
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
[4] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 34
[order.product.attribute.name] => Dimensione
[order.product.attribute.code] => text
[order.product.attribute.value] => 79x20cm
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
[5] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 35
[order.product.attribute.name] => UUID
[order.product.attribute.code] => text
[order.product.attribute.value] => 1724581984.007
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
)
[attributesMap:Aimeos\MShop\Order\Item\Product\Base:private] => Array
(
[custom] => Array
(
[text] => Array
(
[30] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 30
[order.product.attribute.name] => Colore
[order.product.attribute.code] => text
[order.product.attribute.value] => blue
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
[31] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 31
[order.product.attribute.name] => Font
[order.product.attribute.code] => text
[order.product.attribute.value] => caramel
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
[32] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 32
[order.product.attribute.name] => Testo
[order.product.attribute.code] => text
[order.product.attribute.value] => RM 012345 X
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
[33] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 33
[order.product.attribute.name] => Altezza
[order.product.attribute.code] => text
[order.product.attribute.value] => 20
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
[34] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 34
[order.product.attribute.name] => Dimensione
[order.product.attribute.code] => text
[order.product.attribute.value] => 79x20cm
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
[35] => Aimeos\MShop\Order\Item\Product\Attribute\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => order.product.attribute.
[type:protected] =>
[bdata:protected] => Array
(
[order.product.attribute.siteid] => 1.
[order.product.attribute.attributeid] => 35
[order.product.attribute.name] => UUID
[order.product.attribute.code] => text
[order.product.attribute.value] => 1724581984.007
[order.product.attribute.type] => custom
[order.product.attribute.quantity] => 1
)
)
)
)
)
[price:Aimeos\MShop\Order\Item\Product\Base:private] => Aimeos\MShop\Price\Item\Standard Object
(
[available:protected] => 1
[modified:protected] => 1
[bprefix:protected] => price.
[type:protected] =>
[bdata:protected] => Array
(
[price.id] => 50649
[price.siteid] => 1.
[price.type] => default
[price.currencyid] => EUR
[price.domain] => product
[price.label] =>
[price.quantity] => 1
[price.value] => 13.21
[price.costs] => 0.00
[price.rebate] => 0.00
[price.taxrate] => {"tax":"22.00"}
[price.status] => 1
[price.mtime] => 2024-08-22 14:35:24
[price.ctime] => 2024-08-22 14:13:06
[price.editor] => fantin.emanuele@gmail.com
[price.taxrates] => Array
(
[tax] => 22.00
)
[.currencyid] => EUR
[.precision] => 2
[price.taxflag] => 1
)
[precision:Aimeos\MShop\Price\Item\Base:private] => 2
[listPrepared:Aimeos\MShop\Price\Item\Base:private] =>
[listItems:Aimeos\MShop\Price\Item\Base:private] => Array
(
)
[listRefItems:Aimeos\MShop\Price\Item\Base:private] => Array
(
)
[listRmItems:Aimeos\MShop\Price\Item\Base:private] => Array
(
)
[listRmMap:Aimeos\MShop\Price\Item\Base:private] => Array
(
)
[listMap:Aimeos\MShop\Price\Item\Base:private] => Array
(
)
[listMax:Aimeos\MShop\Price\Item\Base:private] => 0
[propItems:Aimeos\MShop\Price\Item\Base:private] => Array
(
)
[propRmItems:Aimeos\MShop\Price\Item\Base:private] => Array
(
)
[propMax:Aimeos\MShop\Price\Item\Base:private] => 0
[currencyid:Aimeos\MShop\Price\Item\Standard:private] => EUR
[tax:Aimeos\MShop\Price\Item\Standard:private] =>
)
)
Re: Set a custom price for a product when added to cart
Hard to say. The price of all products could only change if you set it for all products or if the price item is the same object (which can not be the case here).
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,
