[HACK] Login for price

Modules, Add-ons and custom code that's more than just a quick hack or Mod.
stefanjohannsen
Posts: 7
Joined: Thu Sep 23, 2010 12:23 pm

Re: [HACK] Login for price

Post by stefanjohannsen »

Hi Painstik

I can see that you creates custom codes and hack for ISC

What I need i a hack quite simple to the one in the above thread. It should be like this:
- Guest cannot see prices, they get a "login for prices" message instead of the price
- Once a guest register and log in, they can see the prices immediately. No need for verification by the shop admin

Could you help me to do a hack like this, and give me a roughly quote on it? It's quite urgent
Currently running Shooping Cart version 5.5.4

Thanks in advance.

Stefan Johannsen, Denmark
meules
Confirmed
Confirmed
Posts: 95
Joined: Wed Jun 17, 2009 8:56 pm
Location: NL

Re: [HACK] Login for price

Post by meules »

Isn't that exactly what this script does?? See the very first thread...
ISC v6
stefanjohannsen
Posts: 7
Joined: Thu Sep 23, 2010 12:23 pm

Re: [HACK] Login for price

Post by stefanjohannsen »

I sounds like yes. But I can't get it to work on version 5.5.4 ?
Snooper
Posts: 264
Joined: Sat Jun 26, 2010 9:22 pm

Re: [HACK] Login for price

Post by Snooper »

'@ stefanjohannsen

The 'hack' does work in ISC 5.5.4, so its odd you are having problems..

Here (for a while) is a test site showing a working example ---http://www.ihost4u.co.uk/xcart2/

Try - Email address: test@test.com Password: test
Last edited by Snooper on Thu Apr 05, 2012 7:51 pm, edited 2 times in total.
ISC 5.5.4 Ultimate : Being used here -- http://www.kdklondon.com
stefanjohannsen
Posts: 7
Joined: Thu Sep 23, 2010 12:23 pm

Re: [HACK] Login for price

Post by stefanjohannsen »

As soon as I replace he code as described in the very first thread I get this error when accessing the shop in the front-end:

Code: Select all

Parse error: syntax error, unexpected T_STRING in /var/www/vhosts/XXXXX/httpdocs/lib/pricing.php on line 21
This is how the first lines in the file "pricing.php" looks:

Code: Select all

<?php

if (!defined('ISC_BASE_PATH')) {
	die(" ");
}

require_once(ISC_BASE_PATH."/lib/currency.php");

/**
 * Calculate the final product price. This function will calculate the final product price, including all the group/category/individual discounts
 *
 * @param array The product record array
 * @param boolean True to format price to the currency locale currency. Default is true
 * @param boolean True to convert price to the currency locale currency exchange rate. Default is true
 * @param boolean Set to true if we want to show a struck out version of the retail price if this product has one. Defaults to true
 * @return string The converted price
 */
function CalculateProductPrice($product, $doLocaleFormat=true, $doCurrencyConvert=true, $strikeOutRetail=true)
{

   ###### LOGIN FOR PRICE HACK BOF#############
   $customerClass = GetClass('ISC_CUSTOMER');
   if(!$customerClass->GetCustomerId()) {
    return '<a href="%%GLOBAL_ShopPathNormal%%/login.php">Login for price</a>';
   }  
   ###### LOGIN FOR PRICE HACK EOF#############

   if (!GetConfig('ShowProductPrice') || $product['prodhideprice'] == 1) {
      return '';
   }

   $actualPrice = CalcRealPrice($product['prodprice'], $product['prodretailprice'], $product['prodsaleprice'], $product['prodistaxable']);
   $actualPrice = CalcProdCustomerGroupPrice($product, $actualPrice);
	}
Any help would be appreciated :-)
meules
Confirmed
Confirmed
Posts: 95
Joined: Wed Jun 17, 2009 8:56 pm
Location: NL

Re: [HACK] Login for price

Post by meules »

Stefan,

Try this instead:

In pricing.php

Code: Select all

function CalculateProductPrice($product, $doLocaleFormat=true, $doCurrencyConvert=true, $strikeOutRetail=true)
{
###### LOGIN FOR PRICE HACK BOF#############
   $customerClass = GetClass('ISC_CUSTOMER');
   if(!$customerClass->GetCustomerId()) {
    return '<a href="%%GLOBAL_ShopPathNormal%%/login.php">Login for price</a>';
   }  
###### LOGIN FOR PRICE HACK EOF#############
In productdetails.php around line 59

Code: Select all

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

Let me know
ISC v6
stefanjohannsen
Posts: 7
Joined: Thu Sep 23, 2010 12:23 pm

Re: [HACK] Login for price

Post by stefanjohannsen »

I really appreciate your help - thank you.

But I stil get this error

Code: Select all

Parse error: syntax error, unexpected T_STRING in /var/www/vhosts/xxxxx.dk/httpdocs/lib/pricing.php on line 21
Line 21 in pricing.php is this:

Code: Select all

$customerClass = GetClass('ISC_CUSTOMER');
I don't get it?
meules
Confirmed
Confirmed
Posts: 95
Joined: Wed Jun 17, 2009 8:56 pm
Location: NL

Re: [HACK] Login for price

Post by meules »

Do you have some other modifications made to one of the files?? Probably you have a misplaced comma or something like that...
Attached the two files. I tried it again and it worked seamless...
Let me know ;)
Attachments
ProductDetails.php.txt
(32.94 KiB) Downloaded 716 times
pricing.php.txt
(17.17 KiB) Downloaded 748 times
ISC v6
stefanjohannsen
Posts: 7
Joined: Thu Sep 23, 2010 12:23 pm

Re: [HACK] Login for price

Post by stefanjohannsen »

Thank you so much - now it works :-)

Thank you, thank you, you really made my day!
meules
Confirmed
Confirmed
Posts: 95
Joined: Wed Jun 17, 2009 8:56 pm
Location: NL

Re: [HACK] Login for price

Post by meules »

good to hear!! Good luck... :mrgreen:
ISC v6
Post Reply