Page 4 of 8

Re: [HACK] Login for price

Posted: Thu Jan 28, 2010 2:56 pm
by meules
Painstik many many many thanks....

Unfortnately this doesn't work for me. I tried what you said. Create a new customer, go back to admin, go to edit customer, changed the customer group and then hit save and exit. No email was send. I checked the storelog to see if anything went wrong and what I saw where a few undefined index all in class.customer.php (customergroupid and first name). Maybe I did something wrong?!

I don't want to be a pain in the ass but is it somehow possible to have a notification when the email is send. Like maybe in the green box which says "customer updated succesfully" and then below that something like "customer updated succesfully and email is send" or maybe through an alert box which says "Do you want to send an verification email?" or whatever.

Anyway many thanks for your support.

Cheers

Re: [HACK] Login for price

Posted: Thu Jan 28, 2010 6:19 pm
by Crisper
Thanks Painstik!

It works for me. I got the verification email, HOWEVER, there is no content in the email. I checked the html for the email and that was fine and even tested it with the content of another email template and every time the emails arrive blank. The subject line is correct, though.

Any advice?

Thanks!
Crisper

Re: [HACK] Login for price

Posted: Thu Jan 28, 2010 6:43 pm
by Crisper
I found the problem with the blank email.

In this bit of code in admin/includes/classes/class.customers.php:

Code: Select all

$GLOBALS['FirstName'] = isc_html_escape($StoreCustomer['firstname']);
         $GLOBALS['ISC_LANG']['ThanksForRegisteringEmailLogin'] = sprintf(GetLang('ThanksForRegisteringEmailLogin'), $GLOBALS['ShopPathSSL']."/account.php", $GLOBALS['ShopPathSSL']."/account.php", $GLOBALS['ShopPathSSL']."/account.php");
         
         if ($StoreCustomer['customergroupid']) {
            $store_name = GetConfig('StoreName');
            $subject = GetLang('YourAccountIsVerifiedIntro');

            $emailTemplate = FetchEmailTemplateParser();
            $emailTemplate->SetTemplate("verified_account_email");
            $message = $emailTemplate->ParseTemplate(true);

            require_once(ISC_BASE_PATH . "/lib/email.php");
            $obj_email = GetEmailClass();
            $obj_email->Set('CharSet', GetConfig('CharacterSet'));
            $obj_email->From(GetConfig('OrderEmail'), $store_name);
            $obj_email->Set("Subject", $subject);
            $obj_email->AddBody("html", $message);
            $obj_email->AddRecipient($StoreCustomer['email'], "", "h");
            $email_result = $obj_email->Send();            
         }
The SetTemplate is wrong. It should be:

Code: Select all

$GLOBALS['FirstName'] = isc_html_escape($StoreCustomer['firstname']);
         $GLOBALS['ISC_LANG']['ThanksForRegisteringEmailLogin'] = sprintf(GetLang('ThanksForRegisteringEmailLogin'), $GLOBALS['ShopPathSSL']."/account.php", $GLOBALS['ShopPathSSL']."/account.php", $GLOBALS['ShopPathSSL']."/account.php");
         
         if ($StoreCustomer['customergroupid']) {
            $store_name = GetConfig('StoreName');
            $subject = GetLang('YourAccountIsVerifiedIntro');

            $emailTemplate = FetchEmailTemplateParser();
            $emailTemplate->SetTemplate("verified_account");
            $message = $emailTemplate->ParseTemplate(true);

            require_once(ISC_BASE_PATH . "/lib/email.php");
            $obj_email = GetEmailClass();
            $obj_email->Set('CharSet', GetConfig('CharacterSet'));
            $obj_email->From(GetConfig('OrderEmail'), $store_name);
            $obj_email->Set("Subject", $subject);
            $obj_email->AddBody("html", $message);
            $obj_email->AddRecipient($StoreCustomer['email'], "", "h");
            $email_result = $obj_email->Send();            
         }

Re: [HACK] Login for price

Posted: Thu Jan 28, 2010 7:14 pm
by Painstik
meules wrote:Painstik many many many thanks....

Unfortnately this doesn't work for me. I tried what you said. Create a new customer, go back to admin, go to edit customer, changed the customer group and then hit save and exit. No email was send. I checked the storelog to see if anything went wrong and what I saw where a few undefined index all in class.customer.php (customergroupid and first name). Maybe I did something wrong?!

I don't want to be a pain in the ass but is it somehow possible to have a notification when the email is send. Like maybe in the green box which says "customer updated succesfully" and then below that something like "customer updated succesfully and email is send" or maybe through an alert box which says "Do you want to send an verification email?" or whatever.

Anyway many thanks for your support.

Cheers

You should recheck everything you did, this works 100% for sending emails, only mistake I made is what Crisper said, i didn't wrote right template name.

About alert box, it would be just, like you said pain in the ass, with javascript coding.


Email is sent every time you edit customer which have customer group assigned.

Re: [HACK] Login for price

Posted: Thu Jan 28, 2010 8:35 pm
by meules
Ahh forgot to mention that I was testing V5.5.2!!

Tried it on my live site, is V5.0.6, and it works like a charm. I runned the class.customer.php file from both version 5.0.6 and 5.5.2 through windiff and it appears that some names are changed. That's why it got the undefined index alerts. I will post the updated code here once I've solved the problems and got the alert box to function somehow.

Anyway it works fine now....

Thank you very much...

Re: [HACK] Login for price

Posted: Wed Mar 31, 2010 3:58 pm
by meules
Just to let u know.... the code works for 5.5.4

Re: [HACK] Login for price

Posted: Fri Sep 03, 2010 7:17 pm
by mipra
Such a great thread. Any updated tutorial for 5.5.4? I just cannot get the line described in your step 4 bellow in /INCLUDES/DISPLAY/PRODUCTDETAILS.PHP
meules wrote: 4. Open /INCLUDES/DISPLAY/RODUCTDETAILS.PHP
5. Find somewhere at the bottom around line 302

Code: Select all

	if(GetConfig('AddToCartButtonPosition') == 'middle' && $GLOBALS['ISC_CLASS_PRODUCT']->IsPurchasingAllowed()) {
	require_once ISC_BASE_PATH.'/includes/display/SideProductAddToCart.php';
	ISC_SIDEPRODUCTADDTOCART_PANEL::LoadAddToCartOptions('middle');
	$GLOBALS['SNIPPETS']['ProductAddToCart'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductAddToCart");
	}
6. Replace it with

Code: Select all

	###### LOGIN FOR PRICE HACK BOF#############
	$customerClass = GetClass('ISC_CUSTOMER');
	if(!$customerClass->GetCustomerId()) {
	return;
	}
	###### LOGIN FOR PRICE HACK EOF#############

	if(GetConfig('AddToCartButtonPosition') == 'middle' && $GLOBALS['ISC_CLASS_PRODUCT']->IsPurchasingAllowed()) {
	require_once ISC_BASE_PATH.'/includes/display/SideProductAddToCart.php';
	ISC_SIDEPRODUCTADDTOCART_PANEL::LoadAddToCartOptions('middle');
	$GLOBALS['SNIPPETS']['ProductAddToCart'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductAddToCart");
	}

Re: [HACK] Login for price

Posted: Wed Sep 15, 2010 11:05 pm
by meules
I will update the post soon.

Re: [HACK] Login for price

Posted: Sat Sep 18, 2010 7:27 pm
by meules
@ Mipra

In /INCLUDES/DISPLAY/PRODUCTDETAILS.PHP add around line 59, after

Code: Select all

$this->SetProductVariations();

Code: Select all

		
         ###### LOGIN FOR PRICE HACK BOF#############
         $customerClass = GetClass('ISC_CUSTOMER');
         if(!$customerClass->GetCustomerId()) {
         return;
         }
         $groupId = 0;
         $customerClass = GetClass('ISC_CUSTOMER');
         $customer = $customerClass->GetCustomerInfo();
         if(isset($customer['custgroupid'])) {
         $groupId = $customer['custgroupid'];
         } 
         if($customer['custgroupid'] == 0) {
         return;
         }
         ###### LOGIN FOR PRICE HACK EOF#############
You can skip the part posted in the very first post. Just add this in the file and it should work.

Re: [HACK] Login for price

Posted: Mon Sep 20, 2010 8:36 pm
by meules
Painstik wrote:I've made a little addition to this hack. Add to cart link should be removed from unverified customers, cos with adding a product to cart, you can see the prices of every product.

Open: includes/display/HomeFeaturedProducts.php
Find:

Code: Select all

if (isId($row['prodvariationid']) || trim($row['prodconfigfields'])!='' || $row['prodeventdaterequired'] == 1) {
							$GLOBALS['ProductURL'] = ProdLink($row['prodname']);
							$GLOBALS['ProductAddText'] = GetLang('ProductChooseOptionLink');
.............[/quote]

Painstik,

Do you know a way to do this in v6.0.14? Only in includes/classes/class.product.php these lines are coming back. Not in includes/display/HomeFeaturedProducts.php. I tried to do it this way in the class.product.php file but that doesn't work even when I make a mistake on purpose to see if this is actually the right file... but that didn't even help.

Any help greatly appreciated.