Skip to content

Commit

Permalink
replaced getProducts to getCartProducts and product attribute array key
Browse files Browse the repository at this point in the history
  • Loading branch information
mandan2 committed Sep 11, 2023
1 parent 7067ca6 commit 78e0405
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion subscription/Factory/CreateSubscriptionDataFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function build(Order $order, array $subscriptionProduct): SubscriptionDat
//todo: will need to improve mollie module logic to have shop id or card it so that multishop doesn't break
$molCustomer = $this->customerRepository->findOneBy(['email' => $customer->email]);

$combination = $this->combination->getById((int) $subscriptionProduct['product_attribute_id']);
$combination = $this->combination->getById((int) $subscriptionProduct['id_product_attribute']);
$interval = $this->subscriptionInterval->getSubscriptionInterval($combination);

$currency = $this->currencyAdapter->getById((int) $order->id_currency);
Expand Down
6 changes: 3 additions & 3 deletions subscription/Handler/SubscriptionCreationHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ public function __construct(

public function handle(Order $order, string $method)
{
$products = $order->getProducts();
$products = $order->getCartProducts();
$subscriptionProduct = [];

foreach ($products as $product) {
if (!$this->subscriptionProductValidator->validate((int) $product['product_attribute_id'])) {
if (!$this->subscriptionProductValidator->validate((int) $product['id_product_attribute'])) {
continue;
}

Expand All @@ -65,7 +65,7 @@ private function createRecurringOrdersProduct(array $product): MolRecurringOrder
{
$recurringOrdersProduct = new MolRecurringOrdersProduct();
$recurringOrdersProduct->id_product = $product['id_product'];
$recurringOrdersProduct->id_product_attribute = $product['product_attribute_id'];
$recurringOrdersProduct->id_product_attribute = $product['id_product_attribute'];
$recurringOrdersProduct->quantity = $product['product_quantity'];
$recurringOrdersProduct->unit_price = $product['unit_price_tax_excl'];
$recurringOrdersProduct->add();
Expand Down

0 comments on commit 78e0405

Please sign in to comment.