Jump to content



Photo
* * * * * 2 votes

Newsletter products, HTML email


  • Please log in to reply
266 replies to this topic

#1   scottyb

scottyb
  • Members
  • 57 posts
  • Real Name:Scott
  • Gender:Male
  • Location:Truckee, CA

Posted 01 September 2005 - 17:21

v1.0 was developed using only one language. A couple of people have contacted me about multiple products showing up when more than one language is being used.

Although I had included the $language_id variable in the sql, it's apparent that it doesn't work.

Until I have time to fix the language issue for v1.1, a fix for multiple languages can be simply changing $language_id to the actual number used for the desired language (i.e. '1' for english etc.).
Two occurances of the variable are around lines 31, and 45 of includes/modules/newsletter/newsletter_products.php.

Thanks to Teun for pointing this out.

Edited by scottyb, 01 September 2005 - 17:24.


#2   Teun van Wely

Teun van Wely
  • Members
  • 26 posts
  • Real Name:Teun van Wely
  • Location:Amsterdam

Posted 01 September 2005 - 19:35

v1.0 was developed using only one language. A couple of people have contacted me about multiple products showing up when more than one language is being used.

Although I had included the $language_id variable in the sql, it's apparent that it doesn't work.

Until I have time to fix the language issue for v1.1, a fix for multiple languages can be simply changing $language_id to the actual number used for the desired language (i.e. '1' for english etc.).
Two occurances of the variable are around lines 31, and 45 of includes/modules/newsletter/newsletter_products.php.


There was also a change neaded around line 112 of includes/modules/newsletter/newsletter_products.php. to prevent the module selecting 2 pictures/texts for each product in my bilingual shop.
change:

$images_query = tep_db_query("select p.products_id, pd.products_name, p.products_image from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = p.products_id and p.products_id in(" . $this->products . ")");
}

to:

$images_query = tep_db_query("select p.products_id, pd.language_id, pd.products_name, p.products_image from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.language_id = '1' and pd.products_id = p.products_id and p.products_id in(" . $this->products . ")");
}

Where '1' is the number for the desired language. It now works perfectly for me.

#3   Jemy

Jemy
  • Members
  • 5 posts
  • Real Name:Jerome Manceau

Posted 07 September 2005 - 11:13

Hi scottyb,

what am i doing wrong?

1) I altered newsletter in database
2) I copied the 2 files
admin/includes/languages/english/modules/newsletters/newsletter_products.php
and
admin/includes/modules/newsletters/newsletter_products.php
and changed the other files following your advises.
3) I created "templates" under admin/ and chmod it to 777
4) I created my own html-template, very simple, just with a little text followed by $html_content
5) I opened the newsletter administration tool, chose 2 articles, browsed to my template file and saved the newsletter.
6) however, what I get is an empty mail with only mail subject.

anything i forgot?

thanx for more information.

Jerome

#4   Jemy

Jemy
  • Members
  • 5 posts
  • Real Name:Jerome Manceau

Posted 07 September 2005 - 12:01

Hi scottyb,

what am i doing wrong?

<{POST_SNAPBACK}>


... bit dump, i forgot to select "newsletter_products" as Module...
Now I get few errors, but i think i'll resolve it soon..

Thanx anyway
Jerome

#5   scottyb

scottyb
  • Members
  • 57 posts
  • Real Name:Scott
  • Gender:Male
  • Location:Truckee, CA

Posted 13 September 2005 - 21:48

... bit dump, i forgot to select "newsletter_products" as Module...
Now I get few errors, but i think i'll resolve it soon..

Thanx anyway
Jerome

<{POST_SNAPBACK}>


Did you resolve the other errors? Were they related to this contribution? If so post them so we can troubleshoot this contribution.

#6   waalker

waalker
  • Members
  • 30 posts
  • Real Name:Renee

Posted 14 September 2005 - 03:22

Ok scottyb,
First of all, thanks for the quick reply.

I played around with my newsletter templates for a very long time, and I did get the module to work, which I couldn't before. But I still would like to have more control of how the products display. For instance, the products lay out in a horizontal row (I have only two test products), how do I get them to lay vertical?

Sending Emails. Yes, the screen lets me know the correct number of newsletters to send out, than I press send. Once I press send I see the Animated GIF that says "Please wait .. sending emails .. Please do not interrupt this process!" and than in red it reads "Finished sending emails!" But when I check my test account, no email ever comes. I don't know anything about changing the function for sending an html email. How do I go about doing this?

#7   scottyb

scottyb
  • Members
  • 57 posts
  • Real Name:Scott
  • Gender:Male
  • Location:Truckee, CA

Posted 14 September 2005 - 17:09

Ok scottyb,
  First of all, thanks for the quick reply.

  I played around with my newsletter templates for a very long time, and I did get the module to work, which I couldn't before.  But I still would like to have more control of how the products display.  For instance, the products lay out in a horizontal row (I have only two test products), how do I get them to lay vertical?

  Sending Emails.  Yes, the screen lets me know the correct number of newsletters to send out, than I press send.  Once I press send I see the Animated GIF that says "Please wait .. sending emails ..  Please do not interrupt this process!" and than in red it reads "Finished sending emails!"  But when I check my test account, no email ever comes.  I don't know anything about changing the function for sending an html email.  How do I go about doing this?

<{POST_SNAPBACK}>


Around line 107 of includes/modules/newsletters/newsletter_products.php you'll see:

define('COLS', 2);

Change the 2 to a 1 and you've got a vertical column.

It's tought to say why your emails aren't being sent out yet. Do you have send HTML emails enabled in your admin? If that's not the case, make sure that your $mail_query is retreiving customers on line 169 of includes/modules/newsletters/newsletter_products.php.

You can use:
var_dump($mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, $this->title));
to see what is happening with the actual email line.

Hope this helps

#8   waalker

waalker
  • Members
  • 30 posts
  • Real Name:Renee

Posted 15 September 2005 - 12:03

I have a bigger problem than first thought. I can't send ANY emails from any section of my admin. Apparently I never have, i.e. product notifications, new customer emails or the send mail option in admin.

Can you point me in the right direction on how to fix this?

Do I have to have certain mailing rights from my web host? Can I download software to use with my site? What?

I'm at the point where I would like to launch my website and I can't be fully functional without the email working.

Thanks in advance.

#9   scottyb

scottyb
  • Members
  • 57 posts
  • Real Name:Scott
  • Gender:Male
  • Location:Truckee, CA

Posted 15 September 2005 - 16:26

I have a bigger problem than first thought.  I  can't send ANY emails from any section of my admin.  Apparently I never have, i.e. product notifications, new customer emails or the send mail option in admin.

Can you point me in the right direction on how to fix this?

Do I have to have certain mailing rights from my web host?  Can I download software to use with my site?  What?

I'm at the point where I would like to launch my website and I can't be fully functional without the email working.

Thanks in advance.

<{POST_SNAPBACK}>


Not enough info there to point you in the right direction. Send emails set to true in the admin?

#10   waalker

waalker
  • Members
  • 30 posts
  • Real Name:Renee

Posted 15 September 2005 - 19:33

Not enough info there to point you in the right direction.  Send emails set to true in the admin?

<{POST_SNAPBACK}>



I believe the problem with NO EMAILS is my web host. I must have some kind of restrictions. I will reply here when I find out...

#11   mark27uk3

mark27uk3
  • Members
  • 1,547 posts
  • Real Name:Mark
  • Gender:Male
  • Location:24-7 Mobile Accessories

Posted 30 October 2005 - 16:11

Hi Scott,

I have installed this contrib and I can send the email but as someone previous said the email is blank with just the subject line. I have set 'Use MIME HTML When Sending Emails' to true and also I have the correct module selected for the newsletter_products.

After the email has been sent I get the following errors on the page with the animated brief case.

Warning: Missing argument 3 for newsletter_products() in /home/mobiacc/public_html/admin/includes/modules/newsletters/newsletter_products.php on line 16

Warning: Missing argument 4 for newsletter_products() in /home/mobiacc/public_html/admin/includes/modules/newsletters/newsletter_products.php on line 16

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/mobiacc/public_html/admin/includes/functions/database.php on line 99


Line 16 is this

function newsletter_products($title, $content, $products, $template) {

As for the database.php error I am presuming the errors above are causing this and there is no problem with that file.

Also when I created the newsletter, lock it and then try to edit the newsletter I get these errors

Warning: reset(): Passed variable is not an array or object in /home/mobiacc/public_html/admin/includes/classes/object_info.php on line 17

Warning: Variable passed to each() is not an array or object in /home/mobiacc/public_html/admin/includes/classes/object_info.php on line 18


The basic templates I created for the test newsletter is this

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
$html_content
</body>
</html>

Any help on sorting out these problems would be appreciated as I think this contrib has so much scope. /thumbsup.gif' class='bbc_emoticon' alt=':thumbsup:' />

Thanks

Mark

Edited by mark27uk3, 30 October 2005 - 16:15.

Lifes a bitch, then you marry one, then you die!

#12   scottyb

scottyb
  • Members
  • 57 posts
  • Real Name:Scott
  • Gender:Male
  • Location:Truckee, CA

Posted 30 October 2005 - 21:14

Mark,

It looks like the problem is that somewhere along the line, the module is not saving the products and template to the db. When you preview the newsletter before you send it, you should see the newsletter displayed on the screen.

Around line 279: $module = new newsletter_products($nInfo->title, $nInfo->content, $nInfo->products, $nInfo->template);

Basically, the 3 & 4 parameter error is telling you that $nInfo->products and $nInfo->template are not being passed to the module.

It looks like the root of you problem comes from this error when trying to save the products:

QUOTE
Warning: reset(): Passed variable is not an array or object in /home/mobiacc/public_html/admin/includes/classes/object_info.php on line 17

Warning: Variable passed to each() is not an array or object in /home/mobiacc/public_html/admin/includes/classes/object_info.php on line 18

Double check to make sure that the product values and template are being saved to the db. Your template is fine, the email was blank because of the missing argument failures.

Hope this helps, I've been to busy to make any updates to this module, but hopefully it's helping some people out.

Scott

#13   mark27uk3

mark27uk3
  • Members
  • 1,547 posts
  • Real Name:Mark
  • Gender:Male
  • Location:24-7 Mobile Accessories

Posted 30 October 2005 - 22:53

Hi Scott,

Thanks for the reply.

All fields in the database are populated except for the content field.

Does this mean anything to you?

Mark
Lifes a bitch, then you marry one, then you die!

#14   scottyb

scottyb
  • Members
  • 57 posts
  • Real Name:Scott
  • Gender:Male
  • Location:Truckee, CA

Posted 31 October 2005 - 18:03

Hi Scott,

Thanks for the reply.

All fields in the database are populated except for the content field.

Does this mean anything to you?

Mark


So then it looks like it isn't putting the information into the object_info class.

Do you have this around line 163?

$parameters = array('title' => '',
'content' => '',
'module' => '',
'products' => '',
'template' => '');

Have you tried it with some content? I'm pretty sure I tested it without a message, but give that a whirl.

#15   mark27uk3

mark27uk3
  • Members
  • 1,547 posts
  • Real Name:Mark
  • Gender:Male
  • Location:24-7 Mobile Accessories

Posted 31 October 2005 - 21:54

Hi Scott,

Dont ask me wot I did but it now works - sweet!

The next task for me to do is add the price, special price and a short description of the product.

I am also going to change the table layout so that the product image is on the left and the product name and price etc is on the right of the image.

Any pointers or tips would be welcomed.

Thanks

Mark
Lifes a bitch, then you marry one, then you die!

#16   scottyb

scottyb
  • Members
  • 57 posts
  • Real Name:Scott
  • Gender:Male
  • Location:Truckee, CA

Posted 31 October 2005 - 22:06

Hi Scott,

Dont ask me wot I did but it now works - sweet!

The next task for me to do is add the price, special price and a short description of the product.

I am also going to change the table layout so that the product image is on the left and the product name and price etc is on the right of the image.

Any pointers or tips would be welcomed.

Thanks

Mark


Good to hear. The whole point of this contribution is to be bare bones. Making it this way makes it easier to add other stuff. Check out specials queries in osc, find out what the sql is, then add it to includes/modules/newsletter/newsletter_products.php right near the top. That way, if a product is already on sale, you don't have to replicate the sale within this contribution.

#17   superstyling

superstyling
  • Members
  • 17 posts
  • Real Name:Dean

Posted 17 November 2005 - 07:30

Good to hear. The whole point of this contribution is to be bare bones. Making it this way makes it easier to add other stuff. Check out specials queries in osc, find out what the sql is, then add it to includes/modules/newsletter/newsletter_products.php right near the top. That way, if a product is already on sale, you don't have to replicate the sale within this contribution.


scottyb - I think this is a fantastic contribution that seems to get less attention that it deserves. This module makes it easy for a shop to send newsletters to their customer base without the need for a graphic/web designer which is great.
To add extra value to the recipient I have added the product name, short product info, and (net) price to the message, however attempting to add tax and currency has been fruitless so far with this error:

Fatal error: Call to a member function on a non-object in ../admin/includes/modules/newsletters/newsletter_products.php

Any ideas?

#18   scottyb

scottyb
  • Members
  • 57 posts
  • Real Name:Scott
  • Gender:Male
  • Location:Truckee, CA

Posted 17 November 2005 - 16:43

scottyb - I think this is a fantastic contribution that seems to get less attention that it deserves. This module makes it easy for a shop to send newsletters to their customer base without the need for a graphic/web designer which is great.
To add extra value to the recipient I have added the product name, short product info, and (net) price to the message, however attempting to add tax and currency has been fruitless so far with this error:

Fatal error: Call to a member function on a non-object in ../admin/includes/modules/newsletters/newsletter_products.php

Any ideas?


Thanks superstyling! If I ever get some time I'm going to come out with v2.0 that will fix a couple of issues that others and myself have spotted.

Without knowing what you have tried so far, you should be using the currencies class which is called in application_top.php. So it would be something like $currencies->display_price($price_value, $tax_value, $quantity); to get the price w/tax. All of those variables are something that should happen from within the newsletters.php file (quantity defaults to 1 if not supplied). The error noted above would make it seem like you are trying to use something that has not actually been defined within the currencies class?

#19   mark27uk3

mark27uk3
  • Members
  • 1,547 posts
  • Real Name:Mark
  • Gender:Male
  • Location:24-7 Mobile Accessories

Posted 17 November 2005 - 17:01

Hi scottyb,

Do me a favour and have a look at this bit of code I have put in my newsletter_products module

<td class="main">' . tep_flatten_product_description($images['products_description']) . '<br>'<a href=" . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . "&products_id=" . $bundle_data['products_id'])) .>" . tep_image_button('button_details.gif', IMAGE_BUTTON_DETAILS) . "</a></td></tr>';

I am getting Parse error: parse error, unexpected T_STRING and can not see for the life of me where the problem is.

I am adding loads of the things to this great contrib like short description of products, price, specials price etc etc and my eyes are starting to go googly right about now lol

Thanks

Mark
Lifes a bitch, then you marry one, then you die!

#20   scottyb

scottyb
  • Members
  • 57 posts
  • Real Name:Scott
  • Gender:Male
  • Location:Truckee, CA

Posted 17 November 2005 - 17:06

Hi scottyb,

Do me a favour and have a look at this bit of code I have put in my newsletter_products module

<td class="main">' . tep_flatten_product_description($images['products_description']) . '<br>'<a href=" . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . "&products_id=" . $bundle_data['products_id'])) .>" . tep_image_button('button_details.gif', IMAGE_BUTTON_DETAILS) . "</a></td></tr>';

I am getting Parse error: parse error, unexpected T_STRING and can not see for the life of me where the problem is.

I am adding loads of the things to this great contrib like short description of products, price, specials price etc etc and my eyes are starting to go googly right about now lol

Thanks

Mark


you have an extra ' after the <br>