VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: stawebnice on January 30, 2015, 21:30:44 PM

Title: VM 3.0.2 - custom fields - related products not working
Post by: stawebnice on January 30, 2015, 21:30:44 PM
Hi,

Please help...
I have VM 3.0.2 on Joomla 3.3.6 and I have added a custom field type related products with these settings:
http://imtp.me/8yxw02lj3

but when I save it, I get a  lot of warnings most  of them look like (only lines differ):

Warning: SimpleXMLElement::xpath() [simplexmlelement.xpath]: Unfinished literal in ../libraries/joomla/form/form.php on line 1545

Warning: SimpleXMLElement::xpath() [simplexmlelement.xpath]: xmlXPathEval: evaluation failed in ../libraries/joomla/form/form.php on line 1545

The custom field is saved but when I go to product and want to select it, it is not available in the custom fields selection...

Please advise what is wrong...the complete screenshot with warnings is attached...

Title: Re: VM 3.0.2 - custom fields - related products not working
Post by: GJC Web Design on January 31, 2015, 00:11:18 AM
warnings at least reported fixed on 3.0.3 - 3.0.4 already out -- updates are for a reason......
Title: Re: VM 3.0.2 - custom fields - related products not working
Post by: stawebnice on January 31, 2015, 00:45:42 AM
Hi,

Thank you. I made the update, but still I cannot see the custom field in the product settings even though it is in the list of custom fields. I deleted it and added it again in  the new version, but no change...when I open the custom field again, I get little more settings, so I save it again and still no change...
is there something wrong in its settings?
http://imtp.me/8yym02lj3.p
Title: Re: VM 3.0.2 - custom fields - related products not working
Post by: GJC Web Design on January 31, 2015, 01:14:14 AM
does it need a layout position?  has your template custom field positions?
Title: Re: VM 3.0.2 - custom fields - related products not working
Post by: stawebnice on January 31, 2015, 02:06:14 AM
I don't think so, because other custom fields do not have any layout position in their custom field settings and they do show up in product settings and in front end...
Title: Re: VM 3.0.2 - custom fields - related products not working
Post by: Milbo on February 01, 2015, 16:31:54 PM
This is valid for normal fields. They have a fallback.

But the customfield related products needs a position. The "default" position for the normal layout is "related_products".
Title: Re: VM 3.0.2 - custom fields - related products not working
Post by: stawebnice on February 01, 2015, 17:30:38 PM
Thanks, Milbo, but it did not work, so I contacted the template provider
Title: Re: VM 3.0.2 - custom fields - related products not working
Post by: stawebnice on February 01, 2015, 21:27:36 PM
I managed to  assign the related product in back-end, but they do not show in  front-end.,here is an example:
http://www.responsive.vintagelab15.com/webshop/zitten/eetkamerstoelen/design-stoel-caprice-tube-groen

here is the screenshot from the back-end: http://imtp.me/8z1o02lj3
Title: Re: VM 3.0.2 - custom fields - related products not working
Post by: GJC Web Design on February 01, 2015, 21:54:42 PM
but has your template a rel prod position?

echo shopFunctionsF::renderVmSubLayout('customfields',array('product'=>$this->product,'position'=>'related_products','class'=> 'product-related-products','customTitle' => true ));
Title: Re: VM 3.0.2 - custom fields - related products not working
Post by: stawebnice on February 01, 2015, 23:29:27 PM
No, it was missing but I used your code and pasted it to templates/eshop/html/com_virtuemart/productdetails/default.php  like this and now it works!

Perfect, thank you very much!
Title: Re: VM 3.0.2 - custom fields - related products not working
Post by: tryout on February 01, 2015, 23:34:54 PM
I cannot see the related products too.
In my template related products are shown by this code in com_virtuemart/productdetails/default.php
if (!empty($this->product->customfieldsRelatedProducts)) {
echo $this->loadTemplate('relatedproducts');
    }

and the  com_virtuemart/productdetails/default_relatedproducts.php is
  <?php
    
foreach ($this->product->customfieldsRelatedProducts as $field) {
?>
<div class="product-field product-field-type-<?php echo $field->field_type ?>">
    <span class="product-field-display"><?php echo $field->display ?></span>
</div>
<?php }  ?>

I've tested some changes in the code and in my opinion the problem is
$this->product->customfieldsRelatedProducts
that isn't set (or something like this: I'm not a developer!)
Title: Re: VM 3.0.2 - custom fields - related products not working
Post by: GJC Web Design on February 01, 2015, 23:58:23 PM
if u are on VM3 then

if (!empty($this->product->customfieldsRelatedProducts)) {
   echo $this->loadTemplate('relatedproducts');
    }

is simply wrong - that is VM2 code - there is no default_relatedproducts.php in VM3

use

echo shopFunctionsF::renderVmSubLayout('customfields',array('product'=>$this->product,'position'=>'related_products','class'=> 'product-related-products','customTitle' => true ));
Title: Re: VM 3.0.2 - custom fields - related products not working
Post by: tryout on February 02, 2015, 00:31:49 AM
Thanks! I feared it would be.
Now I can see the related products but under every name there is the same sentence: (italian language) "Prototipo personalizzato per i prodotti correlati"
Can I hide ii'
Thanks
Title: Re: VM 3.0.2 - custom fields - related products not working
Post by: GJC Web Design on February 02, 2015, 11:19:03 AM
by css if u can target it
empty lang constant if a lang constant
Title: Re: VM 3.0.2 - custom fields - related products not working
Post by: dslove on March 25, 2015, 13:21:30 PM
I'm using the below code for related products in my [custom] template, but somehow it's not working for me. Any clues?
I have created a nice tabbed product page with CSS & jQuery, but I'm kinda stuck here... :(


<div id="vmptab5" class="vmptab">
<?php
echo shopFunctionsF::renderVmSubLayout('customfields',array('product'=>$this->product,'position'=>'related_products','class'=> 'product-related-products','customTitle' => true ));
?>

</div>
Title: Re: VM 3.0.2 - custom fields - related products not working
Post by: borro on July 31, 2015, 13:20:51 PM
Hello, friends.

Can somebody tell why custom field of "related product" type cann't be assigned in product card? I created such custom filed but it even cann't be seen in product card among the list of all available custom fileds
VM 3.0.9
Title: Re: VM 3.0.2 - custom fields - related products not working
Post by: Meton on August 06, 2015, 14:36:30 PM
Quote from: borro on July 31, 2015, 13:20:51 PM
Hello, friends.

Can somebody tell why custom field of "related product" type cann't be assigned in product card? I created such custom filed but it even cann't be seen in product card among the list of all available custom fileds
VM 3.0.9

I have got the same question. Can someone please point us in the correct direction?

Kind regards,

Meton
Title: Re: VM 3.0.2 - custom fields - related products not working
Post by: stawebnice on August 06, 2015, 17:47:22 PM
You have to assign the right position : onbot for bottom,  here:
http://imtp.me/9wb402lj3.p

other positions are :ontop, normal a addtocart.
http://www.stawebnice.com/virtuemart-3-souvisejici-produkty

in case the position is not defined in your template, you need to  enter it by this tutorial:
http://www.stawebnice.com/virtuemart-3-nezobrazuje-se-souvisejici-zbozi  (use translate.google.com)

Title: Re: VM 3.0.2 - custom fields - related products not working
Post by: Meton on August 19, 2015, 14:41:14 PM
Quote from: stawebnice on August 06, 2015, 17:47:22 PM
You have to assign the right position : onbot for bottom,  here:
http://imtp.me/9wb402lj3.p

other positions are :ontop, normal a addtocart.
http://www.stawebnice.com/virtuemart-3-souvisejici-produkty

in case the position is not defined in your template, you need to  enter it by this tutorial:
http://www.stawebnice.com/virtuemart-3-nezobrazuje-se-souvisejici-zbozi  (use translate.google.com)

The normal related products work as designed. What doesnt work is that i created a Custom field called "compatible products" I want to assign this to a specific position in my template. But the custom field (compatible products) is not avaiable in the dropdown field @ the custom fields tab of a product.

Kind regards,

Meton