Jump to content

Impossible to access a custom attribute


Recommended Posts

Hi, 

I overrided Product class, added a new attribute and overrided getproducts function from cart class. I need this attribute in cart-detailed-product-line.tpl. I tried to access it with {$product.my_attribute} but it doesn't work. And when I try {var_dump($product)} I can see my attribute, how can I do to access it? This problem only occur in my 1.7.5.1 prestashop version. In the 1.7.8 version everything is fine.

 

Alpha4

Edited by Alpha4 (see edit history)
Link to comment
Share on other sites

Quote
object(PrestaShop\PrestaShop\Adapter\Presenter\Product\ProductListingLazyArray)[379]
  private 'imageRetriever' (PrestaShop\PrestaShop\Adapter\Presenter\Product\ProductLazyArray) => 
    object(PrestaShop\PrestaShop\Adapter\Image\ImageRetriever)[51]
      private 'link' => 
        object(Link)[30]
          protected 'allow' => int 1
          protected 'url' => string '/prestashop2/prestashop_1.7.5.1/index.php' (length=41)
          public 'protocol_link' => string 'http://' (length=7)
          public 'protocol_content' => string 'http://' (length=7)
          protected 'ssl_enable' => string '0' (length=1)
          protected 'urlShopId' => null
  private 'link' (PrestaShop\PrestaShop\Adapter\Presenter\Product\ProductLazyArray) => 
    object(Link)[30]
      protected 'allow' => int 1
      protected 'url' => string '/prestashop2/prestashop_1.7.5.1/index.php' (length=41)
      public 'protocol_link' => string 'http://' (length=7)
      public 'protocol_content' => string 'http://' (length=7)
      protected 'ssl_enable' => string '0' (length=1)
      protected 'urlShopId' => null
  private 'priceFormatter' (PrestaShop\PrestaShop\Adapter\Presenter\Product\ProductLazyArray) => 
    object(PrestaShop\PrestaShop\Adapter\Product\PriceFormatter)[50]
  private 'productColorsRetriever' (PrestaShop\PrestaShop\Adapter\Presenter\Product\ProductLazyArray) => 
    object(PrestaShop\PrestaShop\Adapter\Product\ProductColorsRetriever)[246]
  private 'translator' (PrestaShop\PrestaShop\Adapter\Presenter\Product\ProductLazyArray) => 
    object(PrestaShopBundle\Translation\TranslatorComponent)[41]
      protected 'catalogues' => 
        array (size=1)
          'fr-FR' => 
            object(Symfony\Component\Translation\MessageCatalogue)[47]
              ...
      private 'locale' (Symfony\Component\Translation\Translator) => string 'fr-FR' (length=5)
      private 'fallbackLocales' (Symfony\Component\Translation\Translator) => 
        array (size=0)
          empty
      private 'loaders' (Symfony\Component\Translation\Translator) => 
        array (size=0)
          empty
      private 'resources' (Symfony\Component\Translation\Translator) => 
        array (size=0)
          empty
      private 'formatter' (Symfony\Component\Translation\Translator) => 
        object(Symfony\Component\Translation\Formatter\MessageFormatter)[44]
          private 'selector' => 
            object(Symfony\Component\Translation\MessageSelector)[45]
              ...
      private 'cacheDir' (Symfony\Component\Translation\Translator) => string 'C:\wamp64\www\prestashop2\prestashop_1.7.5.1/var/cache/dev\translations' (length=71)
      private 'debug' (Symfony\Component\Translation\Translator) => boolean false
      private 'configCacheFactory' (Symfony\Component\Translation\Translator) => 
        object(Symfony\Component\Config\ConfigCacheFactory)[46]
          private 'debug' => boolean false
  protected 'settings' => 
    object(PrestaShop\PrestaShop\Core\Product\ProductPresentationSettings)[385]
      public 'catalog_mode' => boolean false
      public 'restricted_country_mode' => null
      public 'include_taxes' => boolean true
      public 'allow_add_variant_to_cart_from_listing' => int 1
      public 'stock_management_enabled' => string '1' (length=1)
      public 'showPrices' => boolean true
      public 'lastRemainingItems' => null
  protected 'product' => 
    array (size=98)
      'id_product_attribute' => string '0' (length=1)
      'id_product' => string '8' (length=1)
      'cart_quantity' => string '2' (length=1)
      'id_shop' => string '1' (length=1)
      'id_customization' => null
      'name' => string 'Mug Today is a good day' (length=23)
      'is_virtual' => string '0' (length=1)
      'description_short' => string '<p><span style="font-size:10pt;font-family:Arial;font-style:normal;">Mug en céramique blanche. 325ml</span></p>' (length=112)
      'available_now' => string '' (length=0)
      'available_later' => string '' (length=0)
      'id_category_default' => string '8' (length=1)
      'id_supplier' => string '0' (length=1)
      'id_manufacturer' => string '1' (length=1)
      'manufacturer_name' => string 'Studio Design' (length=13)
      'on_sale' => string '0' (length=1)
      'ecotax' => string '0.000000' (length=8)
      'additional_shipping_cost' => string '0.00' (length=4)
      'available_for_order' => string '1' (length=1)
      'show_price' => string '1' (length=1)
      'price' => string '22,61 €' (length=10)
      'active' => string '1' (length=1)
      'unity' => string '' (length=0)
      'unit_price_ratio' => string '0.000000' (length=8)
      'quantity_available' => string '300' (length=3)
      'width' => string '0.000000' (length=8)
      'height' => string '0.000000' (length=8)
      'depth' => string '0.000000' (length=8)
      'out_of_stock' => string '2' (length=1)
      'weight' => float 0
      'available_date' => string '0000-00-00' (length=10)
      'date_add' => string '2022-03-19 09:41:42' (length=19)
      'date_upd' => string '2022-03-20 09:54:03' (length=19)
      'quantity' => int 2
      'link_rewrite' => string 'mug-today-is-a-good-day' (length=23)
      'category' => string 'accessoires-de-maison' (length=21)
      'unique_id' => string '0000000008000000000000' (length=22)
      'id_address_delivery' => string '0' (length=1)
      'advanced_stock_management' => string '0' (length=1)
      'supplier_reference' => null
      'colisage' => string '1.7' (length=3)
      'customization_quantity' => null
      'price_attribute' => null
      'ecotax_attr' => null
      'reference' => string 'demo_13' (length=7)
      'weight_attribute' => null
      'ean13' => string '' (length=0)
      'isbn' => string '' (length=0)
      'upc' => string '' (length=0)
      'minimal_quantity' => string '1' (length=1)
      'wholesale_price' => string '0.000000' (length=8)
      'id_image' => string '8-8' (length=3)
      'legend' => string 'Mug Today is a good day' (length=23)
      'reduction_type' => string 'amount' (length=6)
      'is_gift' => boolean false
      'reduction' => float 0
      'price_without_reduction' => float 22.61
      'specific_prices' => boolean false
      'stock_quantity' => int 300
      'price_with_reduction' => float 22.61
      'price_with_reduction_without_tax' => float 22.61
      'total' => string '45,22 €' (length=10)
      'total_wt' => float 45.22
      'price_wt' => float 22.61
      'reduction_applies' => boolean false
      'quantity_discount_applies' => boolean true
      'allow_oosp' => int 0
      'features' => 
        array (size=1)
          0 => 
            array (size=3)
              ...
      'rate' => float 0
      'tax_name' => string '' (length=0)
      'remove_from_cart_url' => string 'http://localhost/prestashop2/prestashop_1.7.5.1/fr/panier?delete=1&id_product=8&id_product_attribute=0&token=746f19fd182b6a4754fb15e3ce53e59c' (length=141)
      'up_quantity_url' => string 'http://localhost/prestashop2/prestashop_1.7.5.1/fr/panier?update=1&id_product=8&id_product_attribute=0&token=746f19fd182b6a4754fb15e3ce53e59c&op=up' (length=147)
      'down_quantity_url' => string 'http://localhost/prestashop2/prestashop_1.7.5.1/fr/panier?update=1&id_product=8&id_product_attribute=0&token=746f19fd182b6a4754fb15e3ce53e59c&op=down' (length=149)
      'update_quantity_url' => string 'http://localhost/prestashop2/prestashop_1.7.5.1/fr/panier?update=1&id_product=8&id_product_attribute=0&token=746f19fd182b6a4754fb15e3ce53e59c' (length=141)
      'ecotax_rate' => string '' (length=0)
      'customizable' => string '' (length=0)
      'online_only' => string '' (length=0)
      'new' => string '' (length=0)
      'condition' => string '' (length=0)
      'pack' => string '' (length=0)
      'price_amount' => string '22,61 €' (length=10)
      'quantity_wanted' => string '2' (length=1)
      'images' => 
        array (size=1)
          0 => 
            array (size=9)
              ...
      'cover' => 
        array (size=9)
          'bySize' => 
            array (size=5)
              ...
          'small' => 
            array (size=3)
              ...
          'medium' => 
            array (size=3)
              ...
          'large' => 
            array (size=3)
              ...
          'legend' => string 'Mug Today is a good day' (length=23)
          'cover' => string '1' (length=1)
          'id_image' => string '8' (length=1)
          'position' => string '1' (length=1)
          'associatedVariants' => 
            array (size=0)
              ...
      'has_discount' => boolean false
      'discount_type' => null
      'discount_percentage' => null
      'discount_percentage_absolute' => null
      'discount_amount' => null
      'discount_amount_to_display' => null
      'regular_price_amount' => string '22,61 €' (length=10)
      'regular_price' => string '22,61 €' (length=10)
      'discount_to_display' => null
      'unit_price_full' => string '' (length=0)
      'unit_price' => string '' (length=0)
      'show_availability' => boolean true
      'availability_date' => null
      'availability_message' => string '' (length=0)
      'availability' => string 'available' (length=9)
  private 'language' (PrestaShop\PrestaShop\Adapter\Presenter\Product\ProductLazyArray) => 
    object(Language)[40]
      public 'id' => int 1
      public 'name' => string 'Français (French)' (length=18)
      public 'iso_code' => string 'fr' (length=2)
      public 'locale' => string 'fr-FR' (length=5)
      public 'language_code' => string 'fr' (length=2)
      public 'date_format_lite' => string 'd/m/Y' (length=5)
      public 'date_format_full' => string 'd/m/Y H:i:s' (length=11)
      public 'is_rtl' => string '0' (length=1)
      public 'active' => string '1' (length=1)
      protected 'webserviceParameters' => 
        array (size=2)
          'objectNodeName' => string 'language' (length=8)
          'objectsNodeName' => string 'languages' (length=9)
      protected 'translationsFilesAndVars' => 
        array (size=5)
          'fields' => string '_FIELDS' (length=7)
          'errors' => string '_ERRORS' (length=7)
          'admin' => string '_LANGADM' (length=8)
          'pdf' => string '_LANGPDF' (length=8)
          'tabs' => string 'tabs' (length=4)
      protected 'id_lang' => null
      protected 'id_shop' => int 1
      public 'id_shop_list' => 
        array (size=0)
          empty
      protected 'get_shop_from_context' => boolean true
      protected 'table' => string 'lang' (length=4)
      protected 'identifier' => string 'id_lang' (length=7)
      protected 'fieldsRequired' => 
        array (size=4)
          0 => string 'name' (length=4)
          1 => string 'iso_code' (length=8)
          2 => string 'date_format_lite' (length=16)
          3 => string 'date_format_full' (length=16)
      protected 'fieldsSize' => 
        array (size=6)
          'name' => int 32
          'iso_code' => int 2
          'locale' => int 5
          'language_code' => int 5
          'date_format_lite' => int 32
          'date_format_full' => int 32
      protected 'fieldsValidate' => 
        array (size=8)
          'name' => string 'isGenericName' (length=13)
          'iso_code' => string 'isLanguageIsoCode' (length=17)
          'locale' => string 'isLocale' (length=8)
          'language_code' => string 'isLanguageCode' (length=14)
          'active' => string 'isBool' (length=6)
          'is_rtl' => string 'isBool' (length=6)
          'date_format_lite' => string 'isPhpDateFormat' (length=15)
          'date_format_full' => string 'isPhpDateFormat' (length=15)
      protected 'fieldsRequiredLang' => 
        array (size=0)
          empty
      protected 'fieldsSizeLang' => 
        array (size=0)
          empty
      protected 'fieldsValidateLang' => 
        array (size=0)
          empty
      protected 'tables' => 
        array (size=0)
          empty
      protected 'image_dir' => null
      protected 'image_format' => string 'jpg' (length=3)
      protected 'translator' => null
      protected 'def' => 
        array (size=4)
          'table' => string 'lang' (length=4)
          'primary' => string 'id_lang' (length=7)
          'fields' => 
            array (size=8)
              ...
          'classname' => string 'Language' (length=8)
      protected 'update_fields' => null
      public 'force_id' => boolean false
  private 'arrayAccessList' (PrestaShop\PrestaShop\Adapter\Presenter\AbstractLazyArray) => 
    object(ArrayObject)[398]
      private 'storage' => 
        array (size=80)
          'add_to_cart_url' => 
            array (size=2)
              ...
          'id' => 
            array (size=2)
              ...
          'attributes' => 
            array (size=2)
              ...
          'show_price' => 
            array (size=2)
              ...
          'weight_unit' => 
            array (size=2)
              ...
          'url' => 
            array (size=2)
              ...
          'canonical_url' => 
            array (size=2)
              ...
          'condition' => 
            array (size=2)
              ...
          'embedded_attributes' => 
            array (size=2)
              ...
          'quantity_discounts' => 
            array (size=2)
              ...
          'reference_to_display' => 
            array (size=2)
              ...
          'seo_availability' => 
            array (size=2)
              ...
          'labels' => 
            array (size=2)
              ...
          'ecotax' => 
            array (size=2)
              ...
          'flags' => 
            array (size=2)
              ...
          'main_variants' => 
            array (size=2)
              ...
          'id_product_attribute' => 
            array (size=2)
              ...
          'id_product' => 
            array (size=2)
              ...
          'cart_quantity' => 
            array (size=2)
              ...
          'id_customization' => 
            array (size=2)
              ...
          'name' => 
            array (size=2)
              ...
          'description_short' => 
            array (size=2)
              ...
          'available_now' => 
            array (size=2)
              ...
          'available_later' => 
            array (size=2)
              ...
          'id_manufacturer' => 
            array (size=2)
              ...
          'manufacturer_name' => 
            array (size=2)
              ...
          'on_sale' => 
            array (size=2)
              ...
          'price' => 
            array (size=2)
              ...
          'quantity' => 
            array (size=2)
              ...
          'link_rewrite' => 
            array (size=2)
              ...
          'category' => 
            array (size=2)
              ...
          'price_attribute' => 
            array (size=2)
              ...
          'ecotax_attr' => 
            array (size=2)
              ...
          'reference' => 
            array (size=2)
              ...
          'ean13' => 
            array (size=2)
              ...
          'isbn' => 
            array (size=2)
              ...
          'upc' => 
            array (size=2)
              ...
          'minimal_quantity' => 
            array (size=2)
              ...
          'id_image' => 
            array (size=2)
              ...
          'legend' => 
            array (size=2)
              ...
          'reduction' => 
            array (size=2)
              ...
          'price_without_reduction' => 
            array (size=2)
              ...
          'specific_prices' => 
            array (size=2)
              ...
          'stock_quantity' => 
            array (size=2)
              ...
          'price_with_reduction' => 
            array (size=2)
              ...
          'price_with_reduction_without_tax' => 
            array (size=2)
              ...
          'total' => 
            array (size=2)
              ...
          'total_wt' => 
            array (size=2)
              ...
          'price_wt' => 
            array (size=2)
              ...
          'allow_oosp' => 
            array (size=2)
              ...
          'rate' => 
            array (size=2)
              ...
          'tax_name' => 
            array (size=2)
              ...
          'remove_from_cart_url' => 
            array (size=2)
              ...
          'up_quantity_url' => 
            array (size=2)
              ...
          'down_quantity_url' => 
            array (size=2)
              ...
          'update_quantity_url' => 
            array (size=2)
              ...
          'ecotax_rate' => 
            array (size=2)
              ...
          'customizable' => 
            array (size=2)
              ...
          'online_only' => 
            array (size=2)
              ...
          'new' => 
            array (size=2)
              ...
          'pack' => 
            array (size=2)
              ...
          'price_amount' => 
            array (size=2)
              ...
          'quantity_wanted' => 
            array (size=2)
              ...
          'images' => 
            array (size=2)
              ...
          'cover' => 
            array (size=2)
              ...
          'has_discount' => 
            array (size=2)
              ...
          'discount_type' => 
            array (size=2)
              ...
          'discount_percentage' => 
            array (size=2)
              ...
          'discount_percentage_absolute' => 
            array (size=2)
              ...
          'discount_amount' => 
            array (size=2)
              ...
          'regular_price_amount' => 
            array (size=2)
              ...
          'regular_price' => 
            array (size=2)
              ...
          'discount_to_display' => 
            array (size=2)
              ...
          'unit_price_full' => 
            array (size=2)
              ...
          'unit_price' => 
            array (size=2)
              ...
          'show_availability' => 
            array (size=2)
              ...
          'availability_date' => 
            array (size=2)
              ...
          'availability_message' => 
            array (size=2)
              ...
          'availability' => 
            array (size=2)
              ...
          'customizations' => 
            array (size=2)
              ...
  private 'arrayAccessIterator' (PrestaShop\PrestaShop\Adapter\Presenter\AbstractLazyArray) => 
    object(ArrayIterator)[414]
      private 'storage' => 
        object(ArrayObject)[398]
          private 'storage' => 
            array (size=80)
              ...
  private 'methodCacheResults' (PrestaShop\PrestaShop\Adapter\Presenter\AbstractLazyArray) => 
    array (size=16)
      'embedded_attributes' => 
        array (size=59)
          'id_product_attribute' => string '0' (length=1)
          'id_product' => string '8' (length=1)
          'id_customization' => null
          'name' => string 'Mug Today is a good day' (length=23)
          'is_virtual' => string '0' (length=1)
          'description_short' => string '<p><span style="font-size:10pt;font-family:Arial;font-style:normal;">Mug en céramique blanche. 325ml</span></p>' (length=112)
          'available_now' => string '' (length=0)
          'available_later' => string '' (length=0)
          'id_category_default' => string '8' (length=1)
          'id_supplier' => string '0' (length=1)
          'id_manufacturer' => string '1' (length=1)
          'on_sale' => string '0' (length=1)
          'ecotax' => string '0.000000' (length=8)
          'additional_shipping_cost' => string '0.00' (length=4)
          'available_for_order' => string '1' (length=1)
          'show_price' => string '1' (length=1)
          'price' => string '22,61 €' (length=10)
          'unity' => string '' (length=0)
          'unit_price_ratio' => string '0.000000' (length=8)
          'out_of_stock' => string '2' (length=1)
          'available_date' => string '0000-00-00' (length=10)
          'date_add' => string '2022-03-19 09:41:42' (length=19)
          'date_upd' => string '2022-03-20 09:54:03' (length=19)
          'quantity' => int 2
          'link_rewrite' => string 'mug-today-is-a-good-day' (length=23)
          'category' => string 'accessoires-de-maison' (length=21)
          'advanced_stock_management' => string '0' (length=1)
          'reference' => string 'demo_13' (length=7)
          'minimal_quantity' => string '1' (length=1)
          'id_image' => string '8-8' (length=3)
          'reduction' => float 0
          'price_without_reduction' => float 22.61
          'specific_prices' => boolean false
          'allow_oosp' => int 0
          'features' => 
            array (size=1)
              ...
          'rate' => float 0
          'tax_name' => string '' (length=0)
          'ecotax_rate' => string '' (length=0)
          'customizable' => string '' (length=0)
          'online_only' => string '' (length=0)
          'new' => string '' (length=0)
          'condition' => string '' (length=0)
          'pack' => string '' (length=0)
          'price_amount' => string '22,61 €' (length=10)
          'quantity_wanted' => string '2' (length=1)
          'images' => 
            array (size=1)
              ...
          'cover' => 
            array (size=9)
              ...
          'has_discount' => boolean false
          'discount_type' => null
          'discount_percentage' => null
          'discount_percentage_absolute' => null
          'discount_amount' => null
          'discount_amount_to_display' => null
          'unit_price_full' => string '' (length=0)
          'unit_price' => string '' (length=0)
          'show_availability' => boolean true
          'availability_date' => null
          'availability_message' => string '' (length=0)
          'availability' => string 'available' (length=9)
      'add_to_cart_url' => string 'http://localhost/prestashop2/prestashop_1.7.5.1/fr/panier?add=1&id_product=8&id_product_attribute=0&token=746f19fd182b6a4754fb15e3ce53e59c' (length=138)
      'id' => string '8' (length=1)
      'attributes' => 
        array (size=0)
          empty
      'show_price' => boolean true
      'weight_unit' => string 'kg' (length=2)
      'url' => string 'http://localhost/prestashop2/prestashop_1.7.5.1/fr/accessoires-de-maison/8-mug-today-is-a-good-day.html' (length=103)
      'canonical_url' => string 'http://localhost/prestashop2/prestashop_1.7.5.1/fr/accessoires-de-maison/8-mug-today-is-a-good-day.html' (length=103)
      'condition' => boolean false
      'quantity_discounts' => 
        array (size=0)
          empty
      'reference_to_display' => string 'demo_13' (length=7)
      'seo_availability' => string 'https://schema.org/InStock' (length=26)
      'labels' => 
        array (size=2)
          'tax_short' => string 'TTC' (length=3)
          'tax_long' => string 'TTC' (length=3)
      'ecotax' => 
        array (size=3)
          'value' => string '0,00 €' (length=9)
          'amount' => string '0.000000' (length=8)
          'rate' => string '' (length=0)
      'flags' => 
        array (size=0)
          empty
      'main_variants' => 
        array (size=0)
          empty

 

I want to get 'colisage'.

Thanks for your help

Link to comment
Share on other sites

Some other attributes are empty. I tried to transform the array in json to see if I can do something with it but the json generated is missing my custom attribute and others attributes.

After That i tried to use ajax to get directly my attribute in the database but I can't pass the js variables to tpl ones.

I also thinked that the error could come from a modification made somewhere in core files. But I get the same problem on a fresh install.

Someone can help me ? 

Link to comment
Share on other sites

Sorry.

Please, as you would like to help without a documented code.
We don't have a oracle to see where you are wrong.
In your case, no one can help without a code.
We can only guess.
This way you will wait a long time for advice.

Example:
I lost a sewing needle in the desert and I can't find it. Can anyone tell me where to look for her and what tools to take?

Link to comment
Share on other sites

14 hours ago, knacky said:

Sorry.

Please, as you would like to help without a documented code.
We don't have a oracle to see where you are wrong.
In your case, no one can help without a code.
We can only guess.
This way you will wait a long time for advice.

Example:
I lost a sewing needle in the desert and I can't find it. Can anyone tell me where to look for her and what tools to take?

I'm Sorry, you're right.

I need an attribute in my cart_detailed-product-line.tpl so I overrided Cart.php, the getProducts function.

<?php
//the only change in my function is here in the first sql select
        // Build SELECT
       $sql->select(/*...*/)// I added p.colisage

Sorry I can't show you more for the the override beacause it trigger a sql error on prestashop.com

After that 'colisage' is added to my array when I var_dump($product) in cart-detailed-product-line.tpl. It wasn't here before the override.

object(PrestaShop\PrestaShop\Adapter\Presenter\Product\ProductListingLazyArray)[379]  // my attribute is ~100 lines down
  private 'imageRetriever' (PrestaShop\PrestaShop\Adapter\Presenter\Product\ProductLazyArray) => 
    object(PrestaShop\PrestaShop\Adapter\Image\ImageRetriever)[51]
      private 'link' => 
        object(Link)[30]
          protected 'allow' => int 1
          protected 'url' => string '/prestashop2/prestashop_1.7.5.1/index.php' (length=41)
          public 'protocol_link' => string 'http://' (length=7)
          public 'protocol_content' => string 'http://' (length=7)
          protected 'ssl_enable' => string '0' (length=1)
          protected 'urlShopId' => null
  private 'link' (PrestaShop\PrestaShop\Adapter\Presenter\Product\ProductLazyArray) => 
    object(Link)[30]
      protected 'allow' => int 1
      protected 'url' => string '/prestashop2/prestashop_1.7.5.1/index.php' (length=41)
      public 'protocol_link' => string 'http://' (length=7)
      public 'protocol_content' => string 'http://' (length=7)
      protected 'ssl_enable' => string '0' (length=1)
      protected 'urlShopId' => null
  private 'priceFormatter' (PrestaShop\PrestaShop\Adapter\Presenter\Product\ProductLazyArray) => 
    object(PrestaShop\PrestaShop\Adapter\Product\PriceFormatter)[50]
  private 'productColorsRetriever' (PrestaShop\PrestaShop\Adapter\Presenter\Product\ProductLazyArray) => 
    object(PrestaShop\PrestaShop\Adapter\Product\ProductColorsRetriever)[246]
  private 'translator' (PrestaShop\PrestaShop\Adapter\Presenter\Product\ProductLazyArray) => 
    object(PrestaShopBundle\Translation\TranslatorComponent)[41]
      protected 'catalogues' => 
        array (size=1)
          'fr-FR' => 
            object(Symfony\Component\Translation\MessageCatalogue)[47]
              ...
      private 'locale' (Symfony\Component\Translation\Translator) => string 'fr-FR' (length=5) // ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
      private 'fallbackLocales' (Symfony\Component\Translation\Translator) => 
        array (size=0)
          empty
      private 'loaders' (Symfony\Component\Translation\Translator) => 
        array (size=0)
          empty
      private 'resources' (Symfony\Component\Translation\Translator) => 
        array (size=0)
          empty
      private 'formatter' (Symfony\Component\Translation\Translator) => 
        object(Symfony\Component\Translation\Formatter\MessageFormatter)[44]  // my attribute is ~50 lines down
          private 'selector' => 
            object(Symfony\Component\Translation\MessageSelector)[45]
              ...
      private 'cacheDir' (Symfony\Component\Translation\Translator) => string 'C:\wamp64\www\prestashop2\prestashop_1.7.5.1/var/cache/dev\translations' (length=71)
      private 'debug' (Symfony\Component\Translation\Translator) => boolean false
      private 'configCacheFactory' (Symfony\Component\Translation\Translator) => 
        object(Symfony\Component\Config\ConfigCacheFactory)[46]
          private 'debug' => boolean false
  protected 'settings' => 
    object(PrestaShop\PrestaShop\Core\Product\ProductPresentationSettings)[385]
      public 'catalog_mode' => boolean false
      public 'restricted_country_mode' => null
      public 'include_taxes' => boolean true
      public 'allow_add_variant_to_cart_from_listing' => int 1
      public 'stock_management_enabled' => string '1' (length=1)
      public 'showPrices' => boolean true
      public 'lastRemainingItems' => null
  protected 'product' => 
    array (size=98)
      'id_product_attribute' => string '0' (length=1)
      'id_product' => string '8' (length=1)
      'cart_quantity' => string '2' (length=1)
      'id_shop' => string '1' (length=1)
      'id_customization' => null
      'name' => string 'Mug Today is a good day' (length=23)// my attribute is ~30 lines down
      'is_virtual' => string '0' (length=1)
      'description_short' => string '<p><span style="font-size:10pt;font-family:Arial;font-style:normal;">Mug en céramique blanche. 325ml</span></p>' (length=112)
      'available_now' => string '' (length=0)
      'available_later' => string '' (length=0)
      'id_category_default' => string '8' (length=1)
      'id_supplier' => string '0' (length=1)
      'id_manufacturer' => string '1' (length=1)
      'manufacturer_name' => string 'Studio Design' (length=13)
      'on_sale' => string '0' (length=1)
      'ecotax' => string '0.000000' (length=8)
      'additional_shipping_cost' => string '0.00' (length=4)
      'available_for_order' => string '1' (length=1)
      'show_price' => string '1' (length=1)
      'price' => string '22,61 €' (length=10)
      'active' => string '1' (length=1)
      'unity' => string '' (length=0)
      'unit_price_ratio' => string '0.000000' (length=8)
      'quantity_available' => string '300' (length=3) //↓↓↓↓↓↓↓↓↓
      'width' => string '0.000000' (length=8)
      'height' => string '0.000000' (length=8)
      'depth' => string '0.000000' (length=8)
      'out_of_stock' => string '2' (length=1)
      'weight' => float 0
      'available_date' => string '0000-00-00' (length=10)
      'date_add' => string '2022-03-19 09:41:42' (length=19)
      'date_upd' => string '2022-03-20 09:54:03' (length=19)
      'quantity' => int 2
      'link_rewrite' => string 'mug-today-is-a-good-day' (length=23)// ↓↓↓↓↓↓↓↓↓↓↓↓
      'category' => string 'accessoires-de-maison' (length=21)
      'unique_id' => string '0000000008000000000000' (length=22)
      'id_address_delivery' => string '0' (length=1)
      'advanced_stock_management' => string '0' (length=1)
      'supplier_reference' => null
      'colisage' => string '1.7' (length=3) // I'm trying to get that attribut with {$product.colisage}
      'customization_quantity' => null
      'price_attribute' => null
      'ecotax_attr' => null
      'reference' => string 'demo_13' (length=7)
      'weight_attribute' => null
      'ean13' => string '' (length=0)
      'isbn' => string '' (length=0)
      'upc' => string '' (length=0)
      'minimal_quantity' => string '1' (length=1)
      'wholesale_price' => string '0.000000' (length=8)
      'id_image' => string '8-8' (length=3)
      'legend' => string 'Mug Today is a good day' (length=23)
      'reduction_type' => string 'amount' (length=6)
      'is_gift' => boolean false
      'reduction' => float 0
      'price_without_reduction' => float 22.61
      'specific_prices' => boolean false
      'stock_quantity' => int 300
      'price_with_reduction' => float 22.61
      'price_with_reduction_without_tax' => float 22.61
      'total' => string '45,22 €' (length=10)
      'total_wt' => float 45.22
      'price_wt' => float 22.61
      'reduction_applies' => boolean false
      'quantity_discount_applies' => boolean true
      'allow_oosp' => int 0
      'features' => 
        array (size=1)
          0 => 
            array (size=3)
              ...
      'rate' => float 0
      'tax_name' => string '' (length=0)
      'remove_from_cart_url' => string 'http://localhost/prestashop2/prestashop_1.7.5.1/fr/panier?delete=1&id_product=8&id_product_attribute=0&token=746f19fd182b6a4754fb15e3ce53e59c' (length=141)
      'up_quantity_url' => string 'http://localhost/prestashop2/prestashop_1.7.5.1/fr/panier?update=1&id_product=8&id_product_attribute=0&token=746f19fd182b6a4754fb15e3ce53e59c&op=up' (length=147)
      'down_quantity_url' => string 'http://localhost/prestashop2/prestashop_1.7.5.1/fr/panier?update=1&id_product=8&id_product_attribute=0&token=746f19fd182b6a4754fb15e3ce53e59c&op=down' (length=149)
      'update_quantity_url' => string 'http://localhost/prestashop2/prestashop_1.7.5.1/fr/panier?update=1&id_product=8&id_product_attribute=0&token=746f19fd182b6a4754fb15e3ce53e59c' (length=141)
      'ecotax_rate' => string '' (length=0)
      'customizable' => string '' (length=0)
      'online_only' => string '' (length=0)
      'new' => string '' (length=0)
      'condition' => string '' (length=0)
      'pack' => string '' (length=0)
      'price_amount' => string '22,61 €' (length=10)
      'quantity_wanted' => string '2' (length=1)
      'images' => 
        array (size=1)
          0 => 
            array (size=9)
              ...
      'cover' => 
        array (size=9)
          'bySize' => 
            array (size=5)
              ...
          'small' => 
            array (size=3)
              ...
          'medium' => 
            array (size=3)
              ...
          'large' => 
            array (size=3)
              ...
          'legend' => string 'Mug Today is a good day' (length=23)
          'cover' => string '1' (length=1)
          'id_image' => string '8' (length=1)
          'position' => string '1' (length=1)
          'associatedVariants' => 
            array (size=0)
              ...
      'has_discount' => boolean false
      'discount_type' => null
      'discount_percentage' => null
      'discount_percentage_absolute' => null
      'discount_amount' => null
      'discount_amount_to_display' => null
      'regular_price_amount' => string '22,61 €' (length=10)
      'regular_price' => string '22,61 €' (length=10)
      'discount_to_display' => null
      'unit_price_full' => string '' (length=0)
      'unit_price' => string '' (length=0)
      'show_availability' => boolean true
      'availability_date' => null
      'availability_message' => string '' (length=0)
      'availability' => string 'available' (length=9)
  private 'language' (PrestaShop\PrestaShop\Adapter\Presenter\Product\ProductLazyArray) => 
    object(Language)[40]
      public 'id' => int 1
      public 'name' => string 'Français (French)' (length=18)
      public 'iso_code' => string 'fr' (length=2)
      public 'locale' => string 'fr-FR' (length=5)
      public 'language_code' => string 'fr' (length=2)
      public 'date_format_lite' => string 'd/m/Y' (length=5)
      public 'date_format_full' => string 'd/m/Y H:i:s' (length=11)
      public 'is_rtl' => string '0' (length=1)
      public 'active' => string '1' (length=1)
      protected 'webserviceParameters' => 
        array (size=2)
          'objectNodeName' => string 'language' (length=8)
          'objectsNodeName' => string 'languages' (length=9)
      protected 'translationsFilesAndVars' => 
        array (size=5)
          'fields' => string '_FIELDS' (length=7)
          'errors' => string '_ERRORS' (length=7)
          'admin' => string '_LANGADM' (length=8)
          'pdf' => string '_LANGPDF' (length=8)
          'tabs' => string 'tabs' (length=4)
      protected 'id_lang' => null
      protected 'id_shop' => int 1
      public 'id_shop_list' => 
        array (size=0)
          empty
      protected 'get_shop_from_context' => boolean true
      protected 'table' => string 'lang' (length=4)
      protected 'identifier' => string 'id_lang' (length=7)
      protected 'fieldsRequired' => 
        array (size=4)
          0 => string 'name' (length=4)
          1 => string 'iso_code' (length=8)
          2 => string 'date_format_lite' (length=16)
          3 => string 'date_format_full' (length=16)
      protected 'fieldsSize' => 
        array (size=6)
          'name' => int 32
          'iso_code' => int 2
          'locale' => int 5
          'language_code' => int 5
          'date_format_lite' => int 32
          'date_format_full' => int 32
      protected 'fieldsValidate' => 
        array (size=8)
          'name' => string 'isGenericName' (length=13)
          'iso_code' => string 'isLanguageIsoCode' (length=17)
          'locale' => string 'isLocale' (length=8)
          'language_code' => string 'isLanguageCode' (length=14)
          'active' => string 'isBool' (length=6)
          'is_rtl' => string 'isBool' (length=6)
          'date_format_lite' => string 'isPhpDateFormat' (length=15)
          'date_format_full' => string 'isPhpDateFormat' (length=15)
      protected 'fieldsRequiredLang' => 
        array (size=0)
          empty
      protected 'fieldsSizeLang' => 
        array (size=0)
          empty
      protected 'fieldsValidateLang' => 
        array (size=0)
          empty
      protected 'tables' => 
        array (size=0)
          empty
      protected 'image_dir' => null
      protected 'image_format' => string 'jpg' (length=3)
      protected 'translator' => null
      protected 'def' => 
        array (size=4)
          'table' => string 'lang' (length=4)
          'primary' => string 'id_lang' (length=7)
          'fields' => 
            array (size=8)
              ...
          'classname' => string 'Language' (length=8)
      protected 'update_fields' => null
      public 'force_id' => boolean false
  private 'arrayAccessList' (PrestaShop\PrestaShop\Adapter\Presenter\AbstractLazyArray) => 
    object(ArrayObject)[398]
      private 'storage' => 

Now I'm trying to get the attribute colisage but I can't

 

On 3/21/2022 at 3:54 PM, Alpha4 said:

I get

but colisage isn't empty

Thanks for your time,

Alpha4

Edited by Alpha4 (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...