How show a product custom field date picker

  • Posts: 84
  • Thank you received: 14
  • Hikashop Business
9 years 11 months ago #202862

-- 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
Attachments:

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

  • Posts: 83778
  • Thank you received: 13566
  • MODERATOR
9 years 11 months ago #202880

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.

  • Posts: 84
  • Thank you received: 14
  • Hikashop Business
9 years 11 months ago #202906

Hi Nicolas, thank you,
Through the "listing_img_title" file of the "product" view of your front-end template, it show Ok.

<?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
Attachments:
Last edit: 9 years 11 months ago by Jabatec.

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

  • Posts: 83778
  • Thank you received: 13566
  • MODERATOR
9 years 11 months ago #202920

Hi,

That's normal with the code you used.
You'll need more complex code to do the conversion:

<?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: 9 years 11 months ago by nicolas.

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

  • Posts: 84
  • Thank you received: 14
  • Hikashop Business
9 years 11 months ago #203008

Hi Nicolas,
replaced the custom field, but web page is not built well.

Code with custom field column -> fecha_ruta

<!-- 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
Attachments:

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

  • Posts: 83778
  • Thank you received: 13566
  • MODERATOR
9 years 11 months ago #203017

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.

  • Posts: 84
  • Thank you received: 14
  • Hikashop Business
9 years 11 months ago #203064

Sorry Nicolas, but the result its the same with next 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.

  • Posts: 83778
  • Thank you received: 13566
  • MODERATOR
9 years 11 months ago #203082

Try like that:

<?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.

  • Posts: 84
  • Thank you received: 14
  • Hikashop Business
9 years 11 months ago #203148

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: 9 years 11 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.072 seconds
Powered by Kunena Forum