Page 5 of 8

Re: [HACK] Login for price

Posted: Thu Sep 30, 2010 10:44 am
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

Re: [HACK] Login for price

Posted: Fri Oct 01, 2010 2:07 pm
by meules
Isn't that exactly what this script does?? See the very first thread...

Re: [HACK] Login for price

Posted: Fri Oct 01, 2010 4:56 pm
by stefanjohannsen
I sounds like yes. But I can't get it to work on version 5.5.4 ?

Re: [HACK] Login for price

Posted: Sat Oct 02, 2010 12:14 pm
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

Re: [HACK] Login for price

Posted: Mon Oct 04, 2010 11:04 am
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 :-)

Re: [HACK] Login for price

Posted: Mon Oct 04, 2010 8:56 pm
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

Re: [HACK] Login for price

Posted: Tue Oct 05, 2010 1:27 pm
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?

Re: [HACK] Login for price

Posted: Tue Oct 05, 2010 11:55 pm
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 ;)

Re: [HACK] Login for price

Posted: Wed Oct 06, 2010 12:13 am
by stefanjohannsen
Thank you so much - now it works :-)

Thank you, thank you, you really made my day!

Re: [HACK] Login for price

Posted: Wed Oct 06, 2010 8:04 pm
by meules
good to hear!! Good luck... :mrgreen: