Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

How To Extend Product_Variations Schema Rate Topic   - - - - -

 
  • Jacek
  • Advanced Member
  • Trial users
  • Join Date: 13-Dec 12
  • 148 posts

Posted 07 October 2019 - 11:47 AM #1

Hi,
I'm  trying to extend schema and I'm having problems.
 
I want to extend app/addons/product_variations/schemas/product_variations/product_types.php with my_custom_field

$schema = [
    Type::PRODUCT_TYPE_SIMPLE    => [
        'name' => __('product_variations.product_type.catalog_item'),
        'allow_generate_variations' => true,
    ],
    Type::PRODUCT_TYPE_VARIATION => [
        'name'          => __('product_variations.product_type.variation_of_catalog_item'),
        'tabs'          => ['detailed', 'images', 'shippings', 'qty_discounts', 'files', 'subscribers', 'variations'],
        'fields'        => [
            'product_id',
            'product_type',
            'product_code',
            'list_price',
            'prices',
            'amount',
            [b]'my_custom_field',[/b]
            'tax_ids',
            'subscribers',
            'files',
            'variation_code',
            'status',
            'timestamp',
            'shippings',
            'weight',
            'shipping_freight',
            'box_height',
            'box_length',
            'box_width',
            'min_items_in_box',
            'max_items_in_box',
            'min_qty',
            'max_qty',
            'qty_step',
            'list_qty_count',
            'availability',
            'avail_since',
            'free_shipping',
            'parent_product_id',
            'variation_features',
            'shipping_params',
        ],
        'field_aliases' => [
            'detailed_id' => 'detailed_image',
            'image_id'    => 'detailed_image',
            'price'       => 'prices',
            'taxes'       => 'tax_ids',
            'main_pair'   => 'detailed_image',
        ],
        'allow_generate_variations' => true,
    ]
];

I'm creating app/addons/my_changes/schemas/product_variations/product_types.post.php with the content:

<?php
use Tygh\Addons\ProductVariations\Product\Type\Type;
use Tygh\Addons\ProductVariations\ServiceProvider;

$schema[Type::PRODUCT_TYPE_VARIATION]['fields'][] = 'my_custom_field';

return $schema;

But the above doesn't work. What am I doing wrong?

 

Thanks in advance!



 
  • soft-solid
  • Junior Member
  • Members
  • Join Date: 19-Apr 10
  • 855 posts

Posted 07 October 2019 - 12:31 PM #2

Hello Jacek

 

I did it yesterday and it works for me.
Try to delete var/cache manually
 
Best regards
Robert

Team of SoftSolid
cs-cart.pl

 
  • Jacek
  • Advanced Member
  • Trial users
  • Join Date: 13-Dec 12
  • 148 posts

Posted 07 October 2019 - 12:47 PM #3

Thanks Robert,

you're right. It was a cache problem.

 

Thank you very much! :-)