Need help for PHP Customfield Plugin

More
10 years 11 months ago #16939 by cedric
Hi,

I bought your extension yesterday and work fine.
My problem is that I need to put a PHP code for the customfield in my template for the plugin appear.. But I don't know what sort of code I can put...

For example, for Related Products, I have this code:
Code:
<?php if (!empty($this->product->customfieldsRelatedProducts)) { ?> <li><a href="#" rel="relproducts"><span><?php echo JText::_('Extraits'); ?></span></a></li> <?php } ?>

I think it's nearly the same, but which one...
Could you help me ?

Thank you very much,
Cédric

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

More
10 years 11 months ago #16940 by nordmograph
Hi

The way I do is: set the plugin on a position(like 'ontop' for eg.) then in
components/com_virtuemart/views/productdetails/tmpl/default.php
(Best is to use template override, copying that default file to
templates/tour_template/html/com_virtuemart/productdetails/default.php )

then set
Code:
if (!empty($this->product->customfieldsSorted['ontop'])) { $this->position = 'ontop'; echo $this->loadTemplate('customfields'); }

wherever you want on the page.


Hope it helps

- Need help? Post the URL of the related page (eventualy as confidential info), it will help solve your issue faster.
- An error, notice or warning? report the exact message including the line number
- If you get a white page , enable error reporting and / or check your server error logs.

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

More
10 years 11 months ago #16954 by cedric
Hi and Thanks for your answer.

I did what you said now, I have this error message:

Warning: Invalid argument supplied for foreach() ... components/com_virtuemart/views/productdetails/tmpl/default_customfields.php on line 26

At the line 26, I found that:
Code:
foreach ($this->product->customfieldsSorted[$this->position] as $field) {

Something wrong? :unsure:

Best regards,
Cédric

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

More
10 years 11 months ago - 10 years 11 months ago #16958 by nordmograph
Not sure but it seems that the script is finding no custom field for the postion you set.

- Need help? Post the URL of the related page (eventualy as confidential info), it will help solve your issue faster.
- An error, notice or warning? report the exact message including the line number
- If you get a white page , enable error reporting and / or check your server error logs.
Last edit: 10 years 11 months ago by nordmograph.

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

More
10 years 11 months ago #16965 by cedric
Thanks for your help,

all is ok now!

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

Time to create page: 0.317 seconds
Powered by Kunena Forum
Disclaimer: Nordmograph is not affiliated with or endorsed by The Joomla! Project™. Any products and services provided through this site are not supported or warrantied by The Joomla! Project or Open Source Matters, Inc. Use of the Joomla!® name, symbol, logo and related trademarks is permitted under a limited license granted by Open Source Matters, Inc.