2 View problems

  • Posts: 8
  • Thank you received: 0
11 years 8 months ago #128048

-- HikaShop version -- :2.2.2 Business
-- Joomla version -- :3.1.5
-- PHP version -- :5.4

Capture 1 shows my first problem , this is a order made from 1 product with some options , i would like to only have quantity and Price on the main product.

My second problem is when i make a order. On the email that is sent to customer i would like to add the product description for the product ordered and for the options chosen, but i cannot fint the variable for the description.

Can someone please help with this.

/Jesper

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 8 months ago #128124

Hi,

For the first one, I think that you just have to enable the option "Group options with product"

And regarding the email, the description is not loaded in the email, you have to get the product _id with "$item->product_id", and then get the product data with:

$productClass = hikashop_get('class.product');
$fullProduct = $productClass->get($item->product_id);
echo $fullProduct->product_description;

Please Log in or Create an account to join the conversation.

  • Posts: 8
  • Thank you received: 0
11 years 8 months ago #128167

Thanks alot problem 1 solved :)
Sorry but im new at this product

Problem 2 i can just change in system - emails and then Order status notification insert the text in html file where i want it to be shown ?

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
11 years 8 months ago #128190

Hi,

For your problem 2, you'll just have to add this code through the "HTML version" section of the page "Hikashop->System->Emails->'YourEmail'" :

<?php
$productClass = hikashop_get('class.product');
$fullProduct = $productClass->get($item->product_id);
echo $fullProduct->product_description;
?>

Please Log in or Create an account to join the conversation.

  • Posts: 8
  • Thank you received: 0
11 years 8 months ago #128233

Hi Again

I have now tried to insert this and i only get a field in my email called description but not the text in the description

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
11 years 8 months ago #128311

Ok, so can you show me how did you insert it ?

Please Log in or Create an account to join the conversation.

  • Posts: 8
  • Thank you received: 0
11 years 8 months ago #128333

I inserted this part in php section

$productClass = hikashop_get('class.product');
$fullProduct = $productClass->get($item->product_id);
echo $fullProduct->product_description;

and then call this part Down in html

<p>
<span style="color:#1c8faf !important;font-size:12px;font-weight:bold;">{TXT:product_description} :</span>
</p>

I hope that was correct :)

Thanks in advance

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
11 years 8 months ago #128367

Like I told you, you should just add this code through the "HTML version" section of your email edition page :

<?php
$productClass = hikashop_get('class.product');
$fullProduct = $productClass->get($item->product_id);
echo $fullProduct->product_description;
?>

Your should probably replace this code (that you have previously put through the "HTML version" section) :
<p>
<span style="color:#1c8faf !important;font-size:12px;font-weight:bold;">{TXT:product_description} :</span>
</p>
By :
<p>
<span style="color:#1c8faf !important;font-size:12px;font-weight:bold;">
<?php
$productClass = hikashop_get('class.product');
$fullProduct = $productClass->get($item->product_id);
echo $fullProduct->product_description;
?>
</span>
</p>

Last edit: 11 years 8 months ago by Mohamed Thelji.

Please Log in or Create an account to join the conversation.

  • Posts: 8
  • Thank you received: 0
11 years 8 months ago #128383

Hi Thanks

That did Work and took the Description for the main product , sorry its probably me that have not described my scenario correctly.

I have a Main product witch have some options and the options have some Characteristics.

Its the description for the Variants the Customer need there is some specific guidelines for customer on the different Variants

Please Log in or Create an account to join the conversation.

  • Posts: 26253
  • Thank you received: 4040
  • MODERATOR
11 years 8 months ago #128428

Adidibau wrote: Its the description for the Variants the Customer need there is some specific guidelines for customer on the different Variants


Hi,

Yes, not simple to understand the first time :)

Mohamed gives you something which can't work in the email. So please, don't use it.
The new templating system for the email is very flexible but we split the code and the design in two files.
You can still put some PHP code in the email but you can't mix the templating and the PHP like that.

In the file "your_email_name.preload.php" you will find this code
if($group){
	foreach($data->cart->products as $j => $optionElement){
		if($optionElement->order_product_option_parent_id != $item->order_product_id) continue;

		$item->order_product_price +=$optionElement->order_product_price;
		$item->order_product_tax +=$optionElement->order_product_tax;
		$item->order_product_total_price+=$optionElement->order_product_total_price;
		$item->order_product_total_price_no_vat+=$optionElement->order_product_total_price_no_vat;

		$t .= '<p class="hikashop_order_option_name">' . $optionElement->order_product_name;
		if($optionElement->order_product_price>0){
			if($config->get('price_with_tax')){
				$t .= ' ( + '.$currencyHelper->format($optionElement->order_product_price+$optionElement->order_product_tax,$data->order->order_currency_id).' )';
			}else{
				$t .= ' ( + '.$currencyHelper->format($optionElement->order_product_price,$data->order->order_currency_id).' )';
			}
		}
		$t .= '</p>';
	}
}
$cartProduct['PRODUCT_NAME'] = $t;
It put the "options" under the product name when the options are grouped.
You have to use the same kind of code in order to load the product description, but per product option.
$optionElement->product_id : will gives you the product id for the selected variant.

So you can add few lines
		if($optionElement->order_product_price>0){
			if($config->get('price_with_tax')){
				$t .= ' ( + '.$currencyHelper->format($optionElement->order_product_price+$optionElement->order_product_tax,$data->order->order_currency_id).' )';
			}else{
				$t .= ' ( + '.$currencyHelper->format($optionElement->order_product_price,$data->order->order_currency_id).' )';
			}
// begin of lines to add
			if(empty($productClass)) $productClass = hikashop_get('class.product');
			$fullProduct = $productClass->get($optionElement->product_id);
			$t .= '<br/>' . $fullProduct->product_description;
// end of lines to add
		}
to add the description for each product option.

Hope it will help you.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: Adidibau

Please Log in or Create an account to join the conversation.

  • Posts: 8
  • Thank you received: 0
11 years 8 months ago #128433

Woow this is working :woohoo:

Thank you

is this something that can get deleted in a update

Please Log in or Create an account to join the conversation.

  • Posts: 26253
  • Thank you received: 4040
  • MODERATOR
11 years 8 months ago #128453

Hi,

Yes you can loose your modification with an update.
The best is to create a copy of the modified file and to rename it : "your_email_name.preload.modified.php"
At this moment, HikaShop will use the ".modified" file and the update will update the original one.
So you will still use your override without any problem.

If you create an override of the "preload", I will recommend you to check that the "your_email_name.html.modified.php" exists too (because the two files are very closed)

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

Time to create page: 0.095 seconds
Powered by Kunena Forum