Jurist Posted January 11, 2017 Share Posted January 11, 2017 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. Link to comment Share on other sites More sharing options...
Knowband Plugins Posted January 12, 2017 Share Posted January 12, 2017 Try this code $product = new Product(Tools::getValue('id_product')); For description forearch($product->description as $desc) echo $desc; For product price Product::getPriceStatic(Tools::getValue('id_product'), true, null, 6); 1 Link to comment Share on other sites More sharing options...
Jurist Posted January 16, 2017 Author Share Posted January 16, 2017 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 Link to comment Share on other sites More sharing options...
Sofando Posted June 19, 2020 Share Posted June 19, 2020 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} Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now