Jump to content

Edit History

Shapes

Shapes

Well, I don't quite understand the logic compared to previous code but I think I finally got it.

public function displayAjax()
{
    $combinationId = (int)Tools::getValue('product_attribute_id');
    $product = new Product((new Combination($combinationId))->id_product);

    $images = $product->getCombinationImages($this->context->language->id);
    $selectedCombinationImages = $images[$combinationId];

    die(Tools::jsonEncode(array($images)));
}

I do not know if it's the cleanest optimized way but it works.

I have one more thing to figure out though I think as Tools::jsonEncode() appears to be deprecated.

Shapes

Shapes

Well, I don't quite understand the logic compared to previous code but I think I finally got it.

public function displayAjax()
{
    $combinationId = (int)Tools::getValue('product_attribute_id');
    $product = new Product((new Combination($combinationId))->id_product);

    $images = $product->getCombinationImages($this->context->language->id);
    $selectedCombinationImages = $images[$combinationId];

    die(Tools::jsonEncode(array($images)));
}

I do not know if it's the cleanest optimized way but it works.

Shapes

Shapes

Well, I don't quite understand the logic compared to previous code but I think I finally got it.

public function displayAjax()
{
    $combinationId = (int)Tools::getValue('product_attribute_id');
    $product = new Product((new Combination($combinationId))->id_product);

    $images = $product->getCombinationImages($this->context->language->id);
    $selectedCombinationImages = $images[(int)Tools::getValue('product_attribute_id')];

    die(Tools::jsonEncode(array($images)));
}

I do not know if it's the cleanest optimized way but it works.

×
×
  • Create New...