Single dropdown custom field in product listings

  • Posts: 57
  • Thank you received: 5
10 years 7 months ago #170336

-- url of the page with the problem -- : localhost
-- HikaShop version -- : 2.3.2
-- Joomla version -- : 3.3.3
-- PHP version -- : 5.4
-- Browser(s) name and version -- : Firefox

Hi Hika team,

I am having trouble adding a single drop down menu with 4 options to my product listings view.

I would like to give my customers the option to be able to choose allergy free food (has been requested a lot).

In custom fields I added a field to the product table with column name allergy. Field type is "single drop down" with my options in it.

The display options are set to:
Front end - no
Back end form - no
Back end listing - yes

In the product listing_image_title I have the following:
<?php echo $this->row->allergy ; ?>

The above usually displays my custom field but not in this case.

I checked in the database and the table row "allergy" is set to NULL.
This explains why the drop down does not appear but why is it set to NULL?

Attached is a screenshot with the full config of the custom field.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 26232
  • Thank you received: 4035
  • MODERATOR
10 years 7 months ago #170344

Hi,

The default value does not mean that the value will be populate into all products. It means that if there is no value and you edit the product, the default value will be pre-populate (or if you display the custom field using the custom field system).
Because you're displaying the "raw value" of the custom field, it just can't work except if you modify every products in your store.
But you can make a SQL query to populate the value in every products ; the other solution will be to change the PHP code in order to use the HikaShop custom field system instead of displaying the raw value.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 57
  • Thank you received: 5
10 years 7 months ago #170503

Hello again,

After reading your comment, I believe what I thought was going to be a simple point and click action is going to be way more complicated.

What I am trying to do is, display a drop down with four options in the product listing and product page. Customers should be able to select one of the options and place an order.

The selected option should appear in the shopping cart overview step and also in the email sent to the customer and admin.

Getting the custom field to appear in the required places should be no problem.

At this point the output of the custom field is one of the options chosen when editing a product. Ultimately my idea was that the custom field would appear only in the front end as a drop down and the option chosen would display in the checkout and emails.

What direction should I take in order to achieve this?

One more additional question. What do you mean by

(or if you display the custom field using the custom field system)

?

Kind regards,

Drago.

Please Log in or Create an account to join the conversation.

  • Posts: 26232
  • Thank you received: 4035
  • MODERATOR
10 years 7 months ago #170588

Hi,

I think you are not using the right kind of custom field.

product custom field - editable in the back-end product page.
display in the front-end product page for the customer (not editable).

item custom field - not visible in the back-end product page
editable in the front-end when the customer add the product in the cart
display in the cart (front-end and back-end).

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

Time to create page: 0.128 seconds
Powered by Kunena Forum