SKU and product link in email

Good day. I have such a problem. A person can ask a question about the product before buying - consultation. To do this, set the widget that is inserted on each product and can use any mail template. The question is how to send in SKU and a link to the product in email? When ordering, I saw solutions - but I just needed to ask about the product.

Hi @AndreySm,

I’ve re-read your question a few times now, and I’m not sure I quite understand what you’re asking. Please, can you elaborate.

It’s simple. There is the usual form of contact - through which you learn the name, emal and the rest. She is in the tab of each product.
There is also a name and SKU for the product. How to add them to email?


And without registering - in guest mode.

So, if I understand correctly… You have added a Contact Form to the Tab Section on each of your Product Pages. But you want the contact form to pre-fill both the Product and SKU fields, so when a customer submits the form then those values are included?

The answer to your question depends completely on how you implemented the Contact Form to begin with.

If this is just a simple ‘copy & paste’ form that’s been added to a Static Block, then I think you’ll have to write some sort of javascript that will copy and paste those values into the form inputs.

However, if this Contact Form is a genuine Magento Module you’ve built from scratch, then you can grab product attributes using the following PHP example. If you wrote the module yourself, then I imagine you also know how to embed the output into the form.

Call product attributes on a Product Page using PHP within a .phtml template file.

$current_product = Mage::registry('current_product');
if($current_product) {
    $sku = $current_product->getSku();
    // output sku
    echo $sku;
}

Note: I’m not a Frontend Developer, so I don’t know what the actual code for any of this would look like. I just know that these are the 2 avenues you’ll have to look into. Hopefully, someone else can help expand on this answer.

Ok. Thanks. I created a custom variable sku.
Which can be added to the template email.


But it does not work PHP.