VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: ridors on November 09, 2012, 14:46:37 PM

Title: show short description in confirmation mail
Post by: ridors on November 09, 2012, 14:46:37 PM
Hi there,

as topic says..

Is there any way to display product short description in confirmation mail?

This don't work in invoice items.php:

<?php echo $item->product_s_desc?>

Thanx for any advises
Title: Re: show short description in confirmation mail
Post by: lanthan on November 10, 2012, 00:29:31 AM
Hi,
there is no product_s_desc in the virtuemart_order_items table in the database which is used for the confirmation e-mail. If you want to get the short description you can use current virtuemart_product_id and then access the virtuemart_product_de_de table with this id and catch the value of virtuemart_product_s_desc.

I hope this helps.

Title: Re: show short description in confirmation mail
Post by: lanthan on November 12, 2012, 00:54:46 AM
OK, a quick and dirty solution for your imvoice_item.php. I do not recommend this way to you as you shouldn´t access database in the output .php but nevertheless I am to lazy to search for you where the items vars are created.

add

at line 21:
$db = JFactory::getDBO ();

at line 49: $q = 'SELECT `product_s_desc` FROM `#__virtuemart_products_de_de` WHERE `virtuemart_product_id`="' . $item->virtuemart_product_id . '" ';
$db->setQuery ($q);
$product_s_desc = $db->loadResult ();


and where you want to show short description
echo $product_s_desc;
Title: Re: show short description in confirmation mail
Post by: ridors on November 13, 2012, 11:01:26 AM
Hi lanthan,

your solution works well as long as your shop is only german.

Any idea how to display in multi language?

Thanks.
Title: Re: show short description in confirmation mail
Post by: bytelord on November 13, 2012, 18:21:16 PM
Hello,

Haven't test it but you could load the product model and print out the product short description:

<?php 
      $ProductModel
VmModel::getModel('product');
       
$product $ProductModel->getProduct($item->virtuemart_product_id);
        echo 
$product->product_s_desc;
?>


Haven't test it but give a try and let us know if that is working for you.

Regards
Title: Re: show short description in confirmation mail
Post by: lanthan on November 13, 2012, 20:24:00 PM
Hi Bytelord,

your solution works fine! Thank you for your support.

Best Regards
Title: Re: show short description in confirmation mail
Post by: bytelord on November 13, 2012, 21:29:25 PM
Great,

never tested but if works ok :)

Always prefer to use model/controllers instead of sql queries because could be expose your site under sql injections on the view side (based on mvc model).

Regards
Title: Re: show short description in confirmation mail
Post by: ridors on November 14, 2012, 16:09:07 PM
Great!

Works fine.

Thanks a lot.
Title: Re: show short description in confirmation mail
Post by: lanthan on November 14, 2012, 19:36:28 PM
@bytelord

You are absolutely right. I have to concern oneself with the vm model/controllers etc. But the API doc link is unfortunately broken...Hope this will be fixed soon or may you have a reference where I can read all the necessary stuff.
Title: Re: show short description in confirmation mail
Post by: bytelord on November 14, 2012, 19:44:10 PM
Hello lanthan,

Yes, there are miss documentation, hopefully this this will be done until the end of the year, but always you can study the code, the view.html.php files to see how the models are been loaded and then use the pagefields as you wish.
Also you take a look on the controllers and also the shopfuntions and how you can use the public one easily :)

But, you have right about the documentation, i study the core source also when i am trying to figure out a solution.

Best regards