Need someone to work out how to hack something

Modules, Add-ons and custom code that's more than just a quick hack or Mod.
Post Reply
Tony Barnes
Posts: 744
Joined: Thu Jun 18, 2009 8:59 am

Need someone to work out how to hack something

Post 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 :(
Tony Barnes
Posts: 744
Joined: Thu Jun 18, 2009 8:59 am

Re: Need someone to work out how to hack something

Post by Tony Barnes »

:evil:
darren1979
Confirmed
Confirmed
Posts: 15
Joined: Wed Oct 28, 2009 4:00 pm

Re: Need someone to work out how to hack something

Post by darren1979 »

Is it only on this one product your having the issue or is it store wide?
Martin
Site Admin
Site Admin
Posts: 1854
Joined: Wed Jun 17, 2009 6:30 pm
Location: South Yorkshire UK
Contact:

Re: Need someone to work out how to hack something

Post 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.
Tony Barnes
Posts: 744
Joined: Thu Jun 18, 2009 8:59 am

Re: Need someone to work out how to hack something

Post 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
Post Reply