devp-eu/tmcms-module-cart

Module Carts for TMCms

Installs: 356

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 4

Forks: 0

pkg:composer/devp-eu/tmcms-module-cart

dev-master 2018-08-16 16:56 UTC

This package is not auto-updated.

Last update: 2025-09-28 07:26:59 UTC


README

Example

$articule = new ArticleEntity($post_data['articule_id']);
$product_type = Converter::classWithNamespaceToUnqualifiedShort($articule);

$current_amount = 0;

$current_item_in_cart = ModuleCart::getCurrentCartItems($product_type);
if ($current_item_in_cart) {
    $current_amount = $current_item_in_cart->getAmount();
}

$cart_item = new CartItemEntity();
$cart_item->setAmount($current_amount + $post_data['amount']);
$cart_item->setItemId($articule->getId());
$cart_item->setItemType($product_type);

ModuleCart::addItem($cart_item);