[HACK] Login for price

Modules, Add-ons and custom code that's more than just a quick hack or Mod.
meules
Confirmed
Confirmed
Posts: 95
Joined: Wed Jun 17, 2009 8:56 pm
Location: NL

Re: [HACK] Login for price

Post 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
ISC v6
Crisper
Posts: 12
Joined: Thu Oct 22, 2009 6:24 pm

Re: [HACK] Login for price

Post 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
Crisper
Posts: 12
Joined: Thu Oct 22, 2009 6:24 pm

Re: [HACK] Login for price

Post 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();            
         }
Painstik
Posts: 122
Joined: Sun Jul 19, 2009 1:19 pm
Location: Croatia

Re: [HACK] Login for price

Post 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.
Need custom coding for Interspire Shopping Cart? Contact me
meules
Confirmed
Confirmed
Posts: 95
Joined: Wed Jun 17, 2009 8:56 pm
Location: NL

Re: [HACK] Login for price

Post 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...
ISC v6
meules
Confirmed
Confirmed
Posts: 95
Joined: Wed Jun 17, 2009 8:56 pm
Location: NL

Re: [HACK] Login for price

Post by meules »

Just to let u know.... the code works for 5.5.4
ISC v6
mipra
Posts: 23
Joined: Fri Sep 03, 2010 7:08 pm

Re: [HACK] Login for price

Post 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");
	}
meules
Confirmed
Confirmed
Posts: 95
Joined: Wed Jun 17, 2009 8:56 pm
Location: NL

Re: [HACK] Login for price

Post by meules »

I will update the post soon.
ISC v6
meules
Confirmed
Confirmed
Posts: 95
Joined: Wed Jun 17, 2009 8:56 pm
Location: NL

Re: [HACK] Login for price

Post 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.
ISC v6
meules
Confirmed
Confirmed
Posts: 95
Joined: Wed Jun 17, 2009 8:56 pm
Location: NL

Re: [HACK] Login for price

Post 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.
ISC v6
Post Reply