Jump to content

Get product price and description variables in module


Recommended Posts

Hello,

 

How do I get current product variables into module? Particularly I would like to add product price and description in email sent by send to a friend module. 

 

Should I define variable in php first and then access it in .html email template help?

Maybe I can access it without defining?

 

I will greatly appreciate any advice.

Share this post


Link to post
Share on other sites

Hello, thanks for your answer, you are great.

 

I am editing send to a friend module, to include current product info to e-mail, not just the message with link

I've dealt with this by editing sendtoafriend_ajax.php file, I added:

 

 

$product = new Product((int)$id_product, false, $module->context->language->id);

$image = Product::getCover((int)$product->id);
$current_price = round(Product::getPriceStatic((int)$product->id), 2, PHP_ROUND_HALF_UP);
 
Thanks for your response, it was really helpful.
 
Now I wonder how to add textbox to let customer pass his own message with this email, similar to order comment in checkout.
If anybody knew the resolution I would be really grateful.
 
Kind regards

Share this post


Link to post
Share on other sites

  • 3 years later...

Hello,

how I can put the description of my product above the name?

{if isset($enable_name) && $enable_name}
                        <a class="product_name" href="{$product.link|escape:'html':'UTF-8'}" title="{$product.name|escape:'html':'UTF-8'}">
                            {$product.name|truncate:35:'...'|escape:'html':'UTF-8'}
                        </a>
 {/if}

Is correct this way?

{if isset($enable_name) && $enable_name}
                        <span class="product_description_short" href="{$product.description_short|escape:'html':'UTF-8'}" title="{$product.description_short|escape:'html':'UTF-8'}">
                            {$product.description_short|truncate:80:'...'|escape:'html':'UTF-8'}                       
 {/if}

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More