Page 1 of 1

Need someone to work out how to hack something

Posted: Mon Nov 09, 2009 6:37 pm
by Tony Barnes
If you look at our site we've got it set up so that there are "members" prices shown - i.e. a price you'd get if you had paid a members fee. This works fine except for with product variations, as these are generated on the fly. See http://www.savant-health.com/products/U ... ganic.html - click on the cheaper bottle, and the members price doesn't change.

The members price is generated in includes/display/ProductDetails.php by this piece of code:
$product = $GLOBALS['ISC_CLASS_PRODUCT']->GetProduct();
$membersPrice = CalcRealPrice($product['prodprice'], $product['prodretailprice'], $product['prodsaleprice']);
$membersPrice = CalcProdCustomerGroupPrice($product, $membersPrice, 2);
$membersPrice = FormatPrice(ConvertPriceToCurrency($membersPrice));
$GLOBALS['MembersPrice'] = $membersPrice;

<!-- this bit is here to handle specific cases where we don't to display the discounted price to the public, even though the members do get a better rate. Don't ask, lol!-->
$GLOBALS['HideMembersPrice'] = '';
$GLOBALS['HideCallForMembersPrice'] = 'display: none';

switch ($product['productid']) {
case 230:
$GLOBALS['HideMembersPrice'] = 'display: none';
$GLOBALS['HideCallForMembersPrice'] = '';
break;
case 231:
$GLOBALS['HideMembersPrice'] = 'display: none';
$GLOBALS['HideCallForMembersPrice'] = '';
break;
case 232:
$GLOBALS['HideMembersPrice'] = 'display: none';
$GLOBALS['HideCallForMembersPrice'] = '';
break;
case 233:
$GLOBALS['HideMembersPrice'] = 'display: none';
$GLOBALS['HideCallForMembersPrice'] = '';
break;
case 234:
$GLOBALS['HideMembersPrice'] = 'display: none';
$GLOBALS['HideCallForMembersPrice'] = '';
break;
}

if($membersPrice >= $GLOBALS['ISC_CLASS_PRODUCT']->GetCalculatedPrice()) {
$GLOBALS['HideMembersPrice'] = 'display: none';
$GLOBALS['HideCallForMembersPrice'] = 'display: none';
}
I've found the bit in includes/classes/class.product.php that generates the variation price:
$variationPrice = CurrencyConvertFormatPrice(CalcProductVariationPrice($variationBasePrice, $variation['vcpricediff'], $variation['vcprice'], $this->_product));
Can anyone sew the 2 together...???? The commented out bit up in the first part of code doesn't need translating through to this part of things, just left it there for completeness.

All this finally came to a head because someone "researched" the members price of a couple of products before signing up as a member, had managed to pick pretty much the only 2 products where the displayed price remained lower than it should of done :(

Re: Need someone to work out how to hack something

Posted: Thu Nov 12, 2009 12:31 pm
by Tony Barnes
:evil:

Re: Need someone to work out how to hack something

Posted: Thu Nov 12, 2009 7:23 pm
by darren1979
Is it only on this one product your having the issue or is it store wide?

Re: Need someone to work out how to hack something

Posted: Fri Nov 13, 2009 1:33 am
by Martin
@ Tony... If you can find about 72 hours of sleep for my wife and 48 hours for me I can probably figure it out for you... Unfortunately I'm swamped with my own store jobs that need doing so right now I'm unavailable.. It might be possible based on what you've said though.

Re: Need someone to work out how to hack something

Posted: Mon Nov 16, 2009 9:57 am
by Tony Barnes
It's every product that there are variations for - it's not a fault of the cart as it's something we've hacked on, but thanks to product variations being script based rather than more database driven, it's a reet pain!

lol - I'll see what I can do Martin, we do sell a natural sleep aid if that's of any help..? ;) :P