How to echo the price and ID value of related products on Product Details page

Started by Genius WebDesign, July 16, 2012, 22:03:34 PM

Previous topic - Next topic

Genius WebDesign

..Continued

If the only things you´re after are to "remove" the product descriptions and "disable" the image-links, then that can actually all be accomplished by only using CSS.

Use this guide to disable the image-link:
http://stackoverflow.com/questions/2091168/disable-a-link-using-css

and apply either an "opacity:0;" or a "display:none;" to the product description text.

Being a CSS-guy myself, I find it more satisfying when the solution is purely based on CSS..




el_carl0s

that's pretty helpful, but wbat about when a product has more than one image and the user wants to browse through them what do i do then?

Genius WebDesign

If you really want to you can actually have the related products look just like the main product, with all the pictures etc., you just have to apply the code in the "for each" loop.
However I did myself find a problem with not being able to echo custom fields for the related products in the loop..



wbauer74

Hi I tried this with version 2.0.12b and it isn't working. I think they changed some things in it. Anyone have this working in the newer version?

Genius WebDesign

I´m sorry, I can´t help you there.

I´m staying with 2.0.6 on my current project. Too many mods to the core for me to upgrade now.


toad78


naoko15

Hi, i'm using  Virtuemart 2.0.12f. Has anyone already made this work in this version? I really need it

Thanks.

LuukDriessen

Hello People,

I was trying to edit the related categories. Thanks for all the info on this forum and especially this topic.

But I have a question.

I succesfully found this line: "defined ( '_JEXEC' ) or die ( 'Restricted access' );"  and added the suggested code.

But when I am trying to find the next line, I'm stuck!

I can't locate: "<span class="product-field-desc"><?php echo jText::_($field->custom_field_desc) ?></span>" in default_relatedproducts.php

So when I add the buttons and prices it doesn't work.

What am I doing wrong?

I am using joomla 2.5.8 and Virtuemart 2.0.18a

Thanks in advance





kratzi

Hi

is there a solution for the new versions of VM2.

I am using 2.0.18a and the default_relatedproducts.php was changed to this code wherefore the described solution does not work any more:


<?php

defined 
'_JEXEC' ) or die ( 'Restricted access' );
?>

        <div class="product-related-products">
    <h4><?php echo JText::_('COM_VIRTUEMART_RELATED_PRODUCTS'); ?></h4>

    <?php
    
foreach ($this->product->customfieldsRelatedProducts as $field) {
    if(!empty($field->display)) {
?>
<div class="product-field product-field-type-<?php echo $field->field_type ?>">
    <span class="product-field-display"><?php echo $field->display ?></span>
<span class="product-fields-title" ><b><?php echo JText::_($field->field->custom_title?></b></span>

</div>
<?php }
    } ?>

        </div>


Regards

Simon

old_fritz

hey there,

thanks a lot for the solutions you worked out.
that works realy good for me.


but i run in kind of same problems, when it comes up to custome fields, which are to insert in the related products:

in detail the problem is, that a vendor logo (gustini) is not shown.
just an option box with the file selected.

what it should show is actually the gustini logo like in the attached detailed view.

i generated that with the custom field "custom title" with the default value "shipping_icon".
for the "custom_value" i set the default value to 43 that´s the id for the logo.

so that works pretty good for the details view. i don´t have any idea why the input of the exact same custome code to the related products result an other appearance.
i guess there´s just something in the code, that tells the related view to show an option box instead of an image.
hopefully not a big thing.

here´s the custome code i insert in the "related_products.php":


<div><?php $custom_title null
if (!empty(
$product->customfields)) {
foreach (
$product->customfields as $field) {
if (
$field->is_hidden //OSP http://forum.virtuemart.net/index.php?topic=99320.0
continue;
if (
$field->display) { ?>

<div><span class="product-field-display"><?php echo $field->display ?></span></div>
<?php ?> <?php ?> <?php }  ?>
</div>



may anybody have got an idea?!
thanks a lot in advance!!!

[attachment cleanup by admin]

MarioP

I refresh the thread because I can't find any solution for the newest VM release. Does anybody has an idea how to place prices in related products for the code below ( default_relatedproducts.php VM 2.0.27 )?
defined ( '_JEXEC' ) or die ( 'Restricted access' );
?>
        <div class="product-related-products">
    <h4><?php echo JText::_('COM_VIRTUEMART_RELATED_PRODUCTS'); ?></h4>

    <?php
    
foreach ($this->product->customfieldsRelatedProducts as $field) {
    if(!empty($field->display)) {
?>
<div class="product-field product-field-type-<?php echo $field->field_type ?>">
    <span class="product-field-display"><?php echo $field->display ?></span>
</div>
<?php }
    } ?>

        </div>

AH

Related products seems to be one aspect of vm2 where the customer experience is a step backwards

I thought the aim of related products was to promote additional spend on items that are related to the item being viewed and possibly added to basket

But without the add to cart and price, this is a slow process that is less likely to succeed and making users "jump" to a single item to add to cart means that the potential for adding multiple related items to cart is based on many circular related item referrences!!

Regards
A

Joomla 4.4.5
php 8.1

MarioP

Yes I agree, lack of price and add to cart button for related products in the product details view is definitely a shortcoming that causes the customers don't have possibility to instant review and decision making. If there was a possibility to add a solution in the next release of VM would be great.
Thanks

MarioP

How to draw VM team (Milbo?) attention to this issue? I see that they rarely visit this forum section - product creation, at least they reply seldomly. ;). The feature would be a great thing and it probably will not take too much time to elaborate appropriate code...So please the VM team or anybody who knows the solution for any feedback - maybe there's some plugin ....