Skip to main content

How show a product custom field date picker

More
11 years 4 months ago #202862 by Jabatec
-- HikaShop version -- : 3.4
-- Joomla version -- : 3.4.1
-- PHP version -- : 2.4.
-- Browser(s) name and version -- : Chrome 43.0

Hi,
I have a product custom field date picker that work fine with a product view.
My problem is that I need show this custom field in a product listing category view, but not show.
I have reviewed next options;

- custom field is ok for category selected in display / custom field
- custom field work fine in backend when I edit a product
. custom field show ok in a view product in front end
- display custom item fields is Ok for display / content menus

but in front end, when I select listing products , custom field not show

Thank you
Javier

Javier Ballester

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

More
11 years 4 months ago #202880 by nicolas
Hi,

There is no option to display the value of a custom product field on a listing of products.

The "Display custom item fields" option is there to display custom item fields on listings of products, not custom product fields.
That would require customizing the view file of the product display on the listing to add the code to display the value of the field.

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

More
11 years 4 months ago - 11 years 4 months ago #202906 by Jabatec
Hi Nicolas, thank you,
Through the "listing_img_title" file of the "product" view of your front-end template, it show Ok.
Code:
<?php echo $this->row->CUSTOMFILED_NAME; ?>

hikashop.com/forum/install-update/869869...product-listing.html

but date format not show the format of custom field.
Format Custom field (OK) > %d-%m-%Y
Format Edit Product > %Y-%m-%d
Format category listing product > %Y-%m-%d

Thank you
Javier

Javier Ballester
Last edit: 11 years 4 months ago by Jabatec.

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

More
11 years 4 months ago - 11 years 4 months ago #202920 by nicolas
Hi,

That's normal with the code you used.
You'll need more complex code to do the conversion:
Code:
<?php $fieldsClass = hikashop_get('class.field'); $element=null; $fields = $fieldsClass->getFields('',$element,'item'); echo $fieldsClass->show($fields['CUSTOMFILED_NAME'], $this->row->CUSTOMFILED_NAME); ?>
Last edit: 11 years 4 months ago by nicolas.

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

More
11 years 4 months ago #203008 by Jabatec
Hi Nicolas,
replaced the custom field, but web page is not built well.

Code with custom field column -> fecha_ruta
Code:
<!-- MOSTRAMOS FECHA CUSTOM FIELD --> <?php echo "Fecha; "; ?> <?php $fieldsClass = hikashop_get('class.field'); $element=null; $fields = $fieldsClass->getFields('',$element,'item'); echo $this->fieldsClass->show($fields['fecha_ruta'], $this->row->fecha_ruta); ?> <!-- FIN FECHA CUSTOM FIELD -->


Thank you very much
Javier

Javier Ballester

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

More
11 years 4 months ago #203017 by nicolas
Hi,

I made a typo.
It should be:
$fieldsClass
instead of:
$this->fieldsClass
on the last line of the code.

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

More
11 years 4 months ago #203064 by Jabatec
Sorry Nicolas, but the result its the same with next code
Code:
<?php echo "Fecha; "; ?> <?php $fieldsClass = hikashop_get('class.field'); $element=null; $fields = $fieldsClass->getFields('',$element,'item'); echo $fieldsClass->show($fields['fecha_ruta'], $this->row->fecha_ruta); ?>

Thank you
Javier

Javier Ballester

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

More
11 years 4 months ago #203082 by nicolas
Try like that:
Code:
<?php echo "Fecha; "; ?> <?php $fieldsClass = hikashop_get('class.field'); $element=null; $fields = $fieldsClass->getFields('',$element,'product'); echo $fieldsClass->show($fields['fecha_ruta'], $this->row->fecha_ruta); ?>
The following user(s) said Thank You: Jabatec

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

More
11 years 4 months ago - 11 years 4 months ago #203148 by Jabatec
Hi Nicolas, Go to infinity and beyond.
Work Fine.

1 - I test new code.-
2 - Edit a Product and go to product custom field
3 - Del date and save
4 - Select new date and save with the new format.
5 - Date custom field of a product, show ok in category listing product

Joomla! Rocks :blink: :silly: ;)

Javier Ballester
Last edit: 11 years 4 months ago by Jabatec.
The following user(s) said Thank You: Jerome

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

Time to create page: 0.188 seconds
Powered by Kunena Forum