News:

Support the VirtueMart project and become a member

Main Menu

[TUT] How to add Short Descriptions to module virtuemart product

Started by lamvt, June 25, 2012, 11:02:13 AM

Previous topic - Next topic

lamvt

Hi, with mod_virtuemart_product to show Products with Image, price and adtocart button.
some one want to add short descriptions to module virtuemart product 2.0 like this:



Can see DEMO here: http://joomquery.com/hardwares-store
, how to do it?
1. Open XML file mod_virtuemart_product.xml :  http://joomquery.com/hardwares-store/modules/mod_virtuemart_product/mod_virtuemart_product.xml
find :
<field name="@spacer" type="spacer" default="" label="" description="" />
Affter add:
<field name="show_short_des" type="list" default="1"
label="Show short descriptions:"
description="Show short descriptions:">
<option value="1">Yes</option>
<option value="0">No</option>
</field>
<field name="short_des_character" type="text" default="300"
label="Short descriptions Text Limited:"
description="Short descriptions Text Limited by character default is 300" />

<field name="@spacer" type="spacer" default="" label="" description="" />



2. Open file mod_virtuemart_product.php http://joomquery.com/hardwares-store/modules/mod_virtuemart_product/mod_virtuemart_product.php

find
if (!class_exists( 'VmModel' )) require(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_virtuemart'.DS.'helpers'.DS.'vmmodel.php');

affter add
$show_short_des = $params->get( 'show_short_des', 1 ); // Show short descriptions? Hack by http://joomquery.com
$short_des_character = trim($params->get( 'short_des_character', 300 )); // descriptions character limited


3. Open default.php http://joomquery.com/hardwares-store/modules/mod_virtuemart_product/tmpl/default.php

Find
if ($show_price)
Remmeber we have 2 positions if ($display_style =="div") and else{}

Before add
if($show_short_des){

echo "<div style='clear:both;'>";
// Product Short Description
if(!empty($product->product_s_desc)) { ?>
<div class="short_des">
<?php echo shopFunctionsF::limitStringByWord($product->product_s_desc$short_des_character'...'?>
</div>
<?php }else{ ?>
<div class="short_des">
<?php echo shopFunctionsF::limitStringByWord($product->product_desc$short_des_character'...'?>
</div>
<?php }
echo "<div style='clear:both;'>";
}



Now Open your module and configuration it again with 2 new parameters:

Show short descriptions: YES NO

Short descriptions Text Limited: NUMBER here default is 300

Goodluck

If you cant do it yourseft, please download my module attachments below

Update 06/28/2012 http://joomquery.com/hardwares-store/mod_vinaora_virtuemart_product.zip


[attachment cleanup by admin]
joomquery - Make website like loving Kids: http://joomquery.com

giupi

Thank you,

I tried to modify the module as you explained, but I can only get the description under the picture and not as tooltip; besides the module pagination get worst: all the items are one over the other and not in one row as previous...

When you say find "if ($show_price)" which one of two in the file do you intend? I tried to put the code both before the first and second "if", and also only bofore the first and only before the second... without success

I also tried to install your module, but I get the following error:

        Fallito caricamento file XML
        /orafolamorgia2/tmp/install_4feb34aab12a8/mod_vinaora_virtuemart_product.xml
        XML: Opening and ending tag mismatch: br line 11 and description
        XML: Opening and ending tag mismatch: br line 11 and install
        XML: Premature end of data in tag br line 11
        XML: Premature end of data in tag br line 11
        XML: Premature end of data in tag description line 11
        XML: Premature end of data in tag install line 3
        JInstaller: :Install: Non รจ stato possibile trovare il file di setup XML di Joomla

Can you help me? I really need to put a short description in the module...

Thank you


lamvt

Hello giupi: Hello Euro 2012
if ($show_price) Before add
if($show_short_des){

echo "<div style='clear:both;'>";
// Product Short Description
if(!empty($product->product_s_desc)) { ?>
<div class="short_des">
<?php echo shopFunctionsF::limitStringByWord($product->product_s_desc$short_des_character'...'?>
</div>
<?php }else{ ?>
<div class="short_des">
<?php echo shopFunctionsF::limitStringByWord($product->product_desc$short_des_character'...'?>
</div>
<?php }
echo "<div style='clear:both;'>";
}


For DIV style and UL LI style


Module Virtuemart with descriptions update here: http://joomquery.com/hardwares-store/mod_vinaora_virtuemart_product.zip

Support: http://joomquery.com/en/home/contact-us.html

joomquery - Make website like loving Kids: http://joomquery.com

giupi

Thank you so much for the module, now the installation has gone fine!

Just one more help please   :)

The description does not come as tooltip, but only under the product name...

Besides if I choose product display DIV I get all the products stacket in a pile even if I set to show them e.g. 4 in a row.

On the other hand by choosing UL display, the products are aligned in row, but since they have different height from different text lenght of their name, they don't fit as in a table.

Thanks a lot! :-)

lamvt

Could you contact me for ToolTIP. I will help you to check: http://joomquery.com/en/home/contact-us.html
About Aligned of Image and descriptions this is Your Style CSS,pls do it (depending on your template css)
We will help you to fix Functions (if not work)
joomquery - Make website like loving Kids: http://joomquery.com