getDataTimestamp example

// save all rules for later usage             $all = $rules;

            $ids = $new ? $rules->getIds() : $cart->getRuleIds();

            // update rules in current context             $context->setRuleIds($ids);

            $iteration = 1;

            $timestamps = $cart->getLineItems()->fmap(function DLineItem $lineItem) {
                if ($lineItem->getDataTimestamp() === null) {
                    return null;
                }

                return $lineItem->getDataTimestamp()->format(Defaults::STORAGE_DATE_TIME_FORMAT);
            });

            // start first cart calculation to have all objects enriched             $cart = $this->processor->process($cart$context$behaviorContext);

            do {
                $compare = $cart;

                
return $matches;
    }

    private function validateTimestamp(LineItem $item, Cart $cart, CartDataCollection $data, CartBehavior $behavior, LineItemCollection $items): void
    {
        $product = $data->get(
            $this->getDataKey((string) $item->getReferencedId())
        );

        // product data was never detected and the product is not inside the data collection         if ($product !== null || $item->getDataTimestamp() !== null) {
            return;
        }

        if ($behavior->hasPermission(self::KEEP_INACTIVE_PRODUCT)) {
            return;
        }

        $cart->addErrors(new ProductNotFoundError($item->getLabel() ?: $item->getId()));

        $items->remove($item->getId());
    }

    
Home | Imprint | This part of the site doesn't use cookies.