News:

Support the VirtueMart project and become a member

Main Menu

Add products into article content

Started by psm, April 02, 2020, 09:45:10 AM

Previous topic - Next topic

psm

Hello,
I installed plugin vmimport to add products into article content. But there is problem, that it shows long description of products info and I need short.

Could you please help me how to reach it? I have this code:
<?php if($showProductDescription){?>
<div class="product_desc_container" style="color:<?php echo $desc_color;?>">
<?php echo $list->product_desc?>
</div>
<?php ?>

I tried to change it by product_s_desc, but it does not know it.

Thank you

beltoforion

Hello psm this, I found answer to that question here: http://forum.virtuemart.net/index.php?topic=106587.0


The right one is    <?php echo $this->product->product_s_desc ?>

and better to use

if (!empty($this->product->product_s_desc)) {
      <?php echo $this->product->product_s_desc;
   } ?>

$this refers to the current product. The code that you post is for category page.

More information regarding $this vs $product explained here: http://forum.virtuemart.net/index.php?topic=100696.0

Product page fields: http://forum.virtuemart.net/index.php?topic=92756.0

Category page fields: http://forum.virtuemart.net/index.php?topic=97744.0
wanting to learn to create good templates

psm

Hello, thank you for response, I tried exsctly this solution also befroe, but it is not working in joomla article. And I do not know why.

Studio 42

Use print_r or var_dump to see the $list content
Check with the Dev, I dont mean that this is a Virtuemart team plugin ?

Jörgen

You have to modify the default.php file of the joomdev plugin, not the tmpl/default.php.

The plugin simply doesn´t put the product_s_desc in the $list structure. You have to make it happen. This is done in the main file for the pugin not the tmpl file.

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.