View Single Post
Old 07-22-2018, 12:40 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline

Join Date: Dec 2010
Posts: 6,373

Default Re: Adding new property to a product (radio button) for Xcart 5

Originally Posted by gior_08

I found a great help in this link so I can add extra properties to products.

This implementation adds a text field in product page (Admin Area).

I want to ask, If I would like to add a radio button what I should change in the code?


Hi there.

I am assuming you are referring to a Yes/No button.
If so, you should make the following change to the module.

1. View/FormModel/Product/Info.php
Add the following line

$schema['default']['myMessage'] = [ 'label' => static::t('My message'), + 'type' => 'XLite\View\FormModel\Type\SwitcherType', 'position' => 900, ];

2. Model/Product.php
Change from

@Column (type="string")
@Column (type="boolean")

That's pretty much it.
If you already have the demo module installed in your store, don't forget to drop the existing 'myMessage' column from the database before re-deploying. Otherwise it will most likely produce an error that data format is incorrect.
Alex Solovev,


User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote