forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 plugins => Topic started by: Catman on January 30, 2007, 09:58:31 am

Title: add {price} and {ORDER_ID} to $lang_photoshop_email_admin
Post by: Catman on January 30, 2007, 09:58:31 am
Hello,

Is it possible to use {price} and {ORDER_ID} in $lang_photoshop_email_admin, in the language PHP file (english.php) When I use it now it returns {PRICE} and {ORDER_ID} in the mail instead of the value.

Is it possible to use the {ORDER_ID} with the current date and a incrementing number?

Kind regards

Frank
Title: Re: add {price} and {ORDER_ID} to $lang_photoshop_email_admin
Post by: Stramm on January 30, 2007, 12:28:08 pm
If you write code that replaces the placeholders you just invented, then yes.
Otherwise no, that feature doesn't exist.
Title: Re: add {price} and {ORDER_ID} to $lang_photoshop_email_admin
Post by: Catman on January 30, 2007, 12:37:02 pm
 ??? So it is not possible to use the placeholders (I did not know they where called that way) in the email for the admin.

By the way: I did not invent them they are in the language files e.g. dutch.php, english.php etc. Or do I misunderstand your answer? ???
Title: Re: add {price} and {ORDER_ID} to $lang_photoshop_email_admin
Post by: Stramm on January 30, 2007, 06:19:46 pm
these are for the email to the user (buyer) and not for the email to the admin

as said, you'll have to write code that does what you're up to.
Title: Re: add {price} and {ORDER_ID} to $lang_photoshop_email_admin
Post by: Catman on January 31, 2007, 08:54:01 am
Ok thanks for your answer;

Unfortunatly my knowledge of PHP is not enough to write the code for this. I have no idea where to start in this matter.
I will use the mail function as it is.

Kind regards

Frank
Title: Re: add {price} and {ORDER_ID} to $lang_photoshop_email_admin
Post by: Stramm on January 31, 2007, 09:27:44 am
easy to do cause the function's already written, you just need to modify it a lil bit so it makes a difference between admin and user

find in photo_shop_checkout.php
Code: [Select]
if (photoshop_add_data($shop_array, $order_id)) { // adding data succeeded
//now email the user
if(photoshop_email_the_user($lang_photoshop_email_order, $lang_photoshop['email_subject_order'])){
//when user got his email, then send to admin
cpg_mail('admin', sprintf($lang_photoshop['email_subject_order_admin'], $CONFIG['gallery_name']), nl2br($lang_photoshop_email_admin));
replace with
Code: [Select]
if (photoshop_add_data($shop_array, $order_id)) { // adding data succeeded
//now email the user
if(photoshop_email_the_user($lang_photoshop_email_order, $lang_photoshop['email_subject_order'])){
//when user got his email, then send to admin
photoshop_email_the_user($lang_photoshop_email_admin, $lang_photoshop['email_subject_order_admin'], true);

replace the entire function photoshop_email_the_user (near the end of photo_shop_checkout.php) with that new version
Code: [Select]
function photoshop_email_the_user($message, $subject, $admin = '')
{
global $CONFIG, $SHOP_CONFIG, $lang_photoshop, $cd_price, $order_id;

$user_info = photoshop_user_details(USER_ID);

if ($admin) {
$user_info['user_email']='admin';
}

$template_vars = array(
'{ORDER_ID}' => $order_id,
'{SITE_NAME}' => $CONFIG['gallery_name'],
'{PRICE}' => number_format(($cd_price[0]+$cd_price[1]+$SHOP_CONFIG['ship']),2),
'{USER_NAME}' => (USER_NAME),
'{ADMIN}' => $CONFIG['gallery_name'],
'{LINK}' => $CONFIG['ecards_more_pic_target'],
);
$mail_body=nl2br(strtr($message, $template_vars));
if(cpg_mail($user_info['user_email'], $subject, $mail_body, 'text/plain', $CONFIG['gallery_name'], $CONFIG['gallery_admin_email'] )) {
return true;
}
return false;
}

you now can use all above placeholders
{ORDER_ID}
{SITE_NAME}  (you set in config)
{ADMIN} same as above (till I know what better to do with it, hehe)
{PRICE}
{USER_NAME}
{LINK} link to your gallery... not to the shop admin, that'll be
{LINK}index.php?file=photo_shop/photo_shop_admin
Title: Re: add {price} and {ORDER_ID} to $lang_photoshop_email_admin
Post by: Catman on January 31, 2007, 07:09:38 pm
Thank you again, this is perfect.

Kind regards

Frank