Forums / Managing Customers and Orders / adding product description to emails problem

adding product description to emails problem

Locked

Started by golowenow on 12 Feb 2007, 2:21 AM · Views: 1,726

Results 1 to 10 of 10
This thread is locked. New replies are disabled.
12 Feb 2007, 2:21 AM
#1
golowenow avatar

golowenow

New Zenner

Join Date:
Jul 2006
Location:
Washington State
Posts:
78
Plugin Contributions:
0

adding product description to emails problem

Hello again,
I think only Dr. Byte will have the answer to this.
The code for adding product descriptions to the invoices/packing slips ect; runs beautifully. I have one slight bug that has developed it seems with the new upgraded version of ZC. The description field is being duplicated after every new item in the NEW ORDER confirmation emails sent to the customer.:cry: Here is an example.

Products
1 x Cuba Scott #165 mint
Scott #165 F(gum thins,usual perf faults) MH $0.50

1 x 1979 Turks and Caicos Islands Scott #386-9 MNH
Scott #165 F(gum thins,usual perf faults) MH
Scott #386-9 PAINTINGS FULL SET VF MNH $0.75

1 x 1985 Tanzania Scott #271-4 MNH
Scott #165 F(gum thins,usual perf faults) MH
Scott #386-9 PAINTINGS FULL SET VF MNH
Scott #271-4 TANZANIA RAILWAYS LOCOMOTIVES
TRAINS FULL SET VF MNH $1.00

1 x 1983 Niger Scott #614-21 FULL SET MNH
Scott #165 F(gum thins,usual perf faults) MH
Scott #386-9 PAINTINGS FULL SET VF MNH
Scott #271-4 TANZANIA RAILWAYS LOCOMOTIVES
TRAINS FULL SET VF MNH
Scott #614-21 RAPHAEL PAINTINGS FULL SET VF MNH $5.50

As you can see the descriptions are being duplicated after each new item. This can be quite lengthy...hehe:yes:

It seems that there may be some changes in the includes\classes\orders.php file that may be effecting this? At about line 844 this code is written:

$this->products_ordered .= $this->products[$i]['qty'] . ' x ' . $this->products[$i]['name'] . ($this->products[$i]['description'] != '' ? ' (' . $this->products[$i]['description'] . ') ' : '') . ' = ' .

I have changed all "MODEL" to "description" to replace model numbers with the descriptions.
I do not remember doing this in older versions though on this and other lines below it. Could this be causing the duplication?
Any advise to this will be greatly appreciated.
Thank you.
JLowe

4 Apr 2007, 4:25 AM
#2
golowenow avatar

golowenow

New Zenner

Join Date:
Jul 2006
Location:
Washington State
Posts:
78
Plugin Contributions:
0

Re: adding product description to emails problem

Never got an answer on this. Would really like to know what is causing this duplication.:huh:

4 Apr 2007, 6:55 AM
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: adding product description to emails problem

Referencing a prior issue with a link to that discussion is always helpful.

I think you're referring to this ... ?
http://www.zen-cart.com/forum/showthread.php?t=42503

The solution I posted there had nothing to do with the orders.php class. However, that is where your current problem exists.

You asked:> includes\classes\orders.php ..... At about line 844 this code is written:

$this->products_ordered .= $this->products[$i]['qty'] . ' x ' . $this->products[$i]['name'] . ($this->products[$i]['description'] != '' ? ' (' . $this->products[$i]['description'] . ') ' : '') . ' = ' .

> 
> Could this be causing the duplication?No, that's not "directly" causing the duplication.

You must have a line earlier that's causing $this->products[$i]['description'] to be concatenated repeatedly, probably with a .=

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

5 Apr 2007, 4:00 AM
#4
golowenow avatar

golowenow

New Zenner

Join Date:
Jul 2006
Location:
Washington State
Posts:
78
Plugin Contributions:
0

Re: adding product description to emails problem

Hello Dr. Byte.
OK here is the Build output for email notification section in its entire form as I have it written right now. Other than changing the MODEL to DESCRIPTION the only other changes on the ORDERS.PHP file are as per your instructions via this thread
http://www.zen-cart.com/forum/showpost.php?p=243512&postcount=10

Here is the section:

// build output for email notification
$this->products_ordered .= $this->products[$i]['qty'] . ' x ' . $this->products[$i]['name'] . ($this->products[$i]['description'] != '' ? ' (' . $this->products[$i]['description'] . ') ' : '') . ' = ' .
$currencies->display_price($this->products[$i]['final_price'], $this->products[$i]['tax'], $this->products[$i]['qty']) .
($this->products[$i]['onetime_charges'] !=0 ? "\n" . TEXT_ONETIME_CHARGES_EMAIL . $currencies->display_price($this->products[$i]['onetime_charges'], $this->products[$i]['tax'], 1) : '') .
$this->products_ordered_attributes . "\n";
$this->products_ordered_html .=
'<tr>' .
'<td class="product-details" align="right" valign="top" width="30">' . $this->products[$i]['qty'] . ' x</td>' .
'<td class="product-details" valign="top">' . $this->products[$i]['name'] . ($this->products[$i]['description'] != '' ? ' (' . $this->products[$i]['description'] . ') ' : '') . ' = ' .
'<nobr><small><em> '. $this->products_ordered_attributes .'</em></small></nobr></td>' .
'<td class="product-details-num" valign="top" align="right">' .
$currencies->display_price($this->products[$i]['final_price'], $this->products[$i]['tax'], $this->products[$i]['qty']) .
($this->products[$i]['onetime_charges'] !=0 ?
'</td></tr><tr><td class="product-details">' . TEXT_ONETIME_CHARGES_EMAIL . '</td>' .
'<td>' . $currencies->display_price($this->products[$i]['onetime_charges'], $this->products[$i]['tax'], 1) : '') .
'</td></tr>';
}

Hope we can figure this out as it is the final "bug" in this mod which perhaps I can donate in the near future for others to use. Thank you again Dr.Byte.:smartalec:

5 Apr 2007, 4:09 AM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: adding product description to emails problem

please attach a copy of your /includes/classes/order.php file. Probably best to zip it first.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

5 Apr 2007, 9:13 AM
#6
golowenow avatar

golowenow

New Zenner

Join Date:
Jul 2006
Location:
Washington State
Posts:
78
Plugin Contributions:
0

Re: adding product description to emails problem

Hello again Dr. Byte.
Here is the full file zipped with Winzip.
Attachment #1687

5 Apr 2007, 9:47 AM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: adding product description to emails problem

On line 741 you have this:```
$this->products_ordered_attributes .= "\n\t" . zen_get_products_description($this->products[$i]['id']);


the .= should just be =

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

8 Apr 2007, 3:20 PM
#8
golowenow avatar

golowenow

New Zenner

Join Date:
Jul 2006
Location:
Washington State
Posts:
78
Plugin Contributions:
0

Re: adding product description to emails problem

This last change in code has done the trick!:clap: . The duplication has stopped. Am now perfecting the mod instructions so others may use it. Thank you Dr. Byte. You are a genius:smartalec:

23 Apr 2007, 12:14 AM
#9
rsprinkel avatar

rsprinkel

New Zenner

Join Date:
Feb 2007
Posts:
73
Plugin Contributions:
0

Re: adding product description to emails problem

HAs this Mod been completed yet? Just wondering.

Thanks in Advance.

RSprinkel

24 Apr 2007, 1:54 AM
#10
golowenow avatar

golowenow

New Zenner

Join Date:
Jul 2006
Location:
Washington State
Posts:
78
Plugin Contributions:
0

Re: adding product description to emails problem

Having issues with PayPal IPN module. Will post specific code changes in a while. Waiting for possible update for Zencart first.:smartalec: