aviaPL
aviaPL

Reputation: 99

How to get all customization from product in prestashop 1.6

I create a module. Which add new tab in product, back office. In this tab I want to display all customization text. Which is define in customization tab. The problem is I don't know how to do that. There is a product, customization or customizationField classes.

I my module I have:

 public function getCustomizationFields(){
        $getCustomizationFields = Product::getCustomizationFieldIds();
        return $getCustomizationFields;
    }

There is no error. Always I have output like this:

array(0) { } 

Is there any class which I can use for my purpose ? Thanks for any help.

Kind regards

Upvotes: 0

Views: 409

Answers (2)

Aurora
Aurora

Reputation: 725

How about

public function getCustomizationFields(){
            $productId = (int)Tools::getValue('id_product');
            $product = new Product($productId);
            $getCustomizationFields = $product->getCustomizationFieldIds();

            return $getCustomizationFields;
}

Upvotes: 0

John Tekker
John Tekker

Reputation: 1

If you have an instance of the Product class, you can do this:

$instance = new Product($product_id);
$instance->getCustomizationFields();

Upvotes: 0

Related Questions