schrift94
schrift94

Reputation: 101

Is this the attribute id connected with the product, that has been ordered?

I am trying to modify the classes/PaymentModule.php file in prestashop. I would like to get the attribute id that has been chosen by the customer. I suppose it's stored in $product['id_product_attribute'] but I am not sure if this is the value I am looking for.

// Construct order detail table for the email
$products_list = '';
$virtual_product = true;

$product_var_tpl_list = array();
foreach ($order->product_list as $product) {
    $price = Product::getPriceStatic((int) $product['id_product'], false, (**$product['id_product_attribute']** ? (int) $product['id_product_attribute'] : null), 6, null, false, true, $product['cart_quantity'], false, (int) $order->id_customer, (int) $order->id_cart, (int) $order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}, $specific_price, true, true, null, true, $product['id_customization']);
    $price_wt = Product::getPriceStatic((int) $product['id_product'], true, ($product['id_product_attribute'] ? (int) $product['id_product_attribute'] : null), 2, null, false, true, $product['cart_quantity'], false, (int) $order->id_customer, (int) $order->id_cart, (int) $order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}, $specific_price, true, true, null, true, $product['id_customization']);

    $product_price = Product::getTaxCalculationMethod() == PS_TAX_EXC ? Tools::ps_round($price, 2) : $price_wt;

    $product_var_tpl = array(
        'id_product' => $product['id_product'],
        'reference' => $product['reference'],
        'name' => $product['name'] . (isset($product['attributes']) ? ' - ' . $product['attributes'] : ''),
        'price' => Tools::displayPrice($product_price * $product['quantity'], $this->context->currency, false),
        'quantity' => $product['quantity'],
        'customization' => array(),
    );

Upvotes: 0

Views: 83

Answers (1)

ethercreation
ethercreation

Reputation: 1273

Try with : $product['product_attribute_id']

Regards

Upvotes: 1

Related Questions