News:

Support the VirtueMart project and become a member

Main Menu

show short description in confirmation mail

Started by ridors, November 09, 2012, 14:46:37 PM

Previous topic - Next topic

ridors

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

lanthan

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.


lanthan

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;

ridors

Hi lanthan,

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

Any idea how to display in multi language?

Thanks.

bytelord

#4
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
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

lanthan

Hi Bytelord,

your solution works fine! Thank you for your support.

Best Regards

bytelord

#6
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
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

ridors


lanthan

@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.

bytelord

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
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!