Page 1 of 1

[HACK] Fixed Shop by Price

Posted: Fri Aug 14, 2009 11:11 pm
by SamX
Do you want to fix your shop by price?

Yes I want, im studing the lines and we need just modify the max product price and min product price.

It will be appear like this:
Shop by price:

* $0.00 - $100.00
* $100.00 - $150.00
* $150.00 - $200.00
* $200.00 - $250.00
* $250.00 - $300.00
* $300.00 - $350.00
* $350.00 - $400.00
* $400.00 - $450.00
* $450.00 - $500.00
Open includes/display/SideCategoryShopByPrice.php

On line 32 under if ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {

Code: Select all

				$min = ceil($row['pmin']);
				$max = ceil($row['pmax'])
Change for this or the number you want

Code: Select all

			if ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
				$min = 50;      // Minimum price product of your store
				$max = 500;   // Maximum price product of your store
In the line 38 you found:

Code: Select all

					$diff = (($max - $min) / 5	);
Change for this:

Code: Select all

					$diff = (($max - $min) / 9	);
Change the link 44

Code: Select all

					for ($i = 0; $i < 5; $i++) {   
For this:

Code: Select all

					for ($i = 0; $i < 9; $i++) {   
Thaths all!!! save and upload the file, i hope you like1

Re: [HACK] Fixed Shop by Price

Posted: Fri Aug 06, 2010 12:21 pm
by Snooper
How would you start the price at 5 rather than 0 pounds??

Re: [HACK] Fixed Shop by Price

Posted: Fri Aug 06, 2010 3:23 pm
by CharlieFoxtrot
Snooper wrote:How would you start the price at 5 rather than 0 pounds??
I agree that "zero-dollars" (pounds) looks a bit odd, and it should be changed to something other than "$0.00".

I'm not sure if this will help... but a quick fix could involve a simple search and replace just before the value of $output is returned.

Search For:

Code: Select all

$GLOBALS['SNIPPETS']['SideCategoryShopByPrice'] = $output;
Change To:

Code: Select all

// ORIGINAL LINE BELOW
// $GLOBALS['SNIPPETS']['SideCategoryShopByPrice'] = $output;
// REPLACE "$0.00" WITH THE WORD "Under"
$GLOBALS['SNIPPETS']['SideCategoryShopByPrice'] = str_replace("$0.00 -", "Under ", $output);
I'm a strong believer in commenting everything! I truly makes things easy if I ever have to return to my previous edits. I also like to preserve the original lines of code by commenting them out (instead of deleting them). In the event that something goes wrong, it's very easy to return to the original working code until I can figure out what the problem is.

FINAL NOTE: I haven't tested this... so if this does not work, please let me know and I'll post any corrections, or delete this post.

Charlie

Re: [HACK] Fixed Shop by Price

Posted: Fri Aug 06, 2010 5:16 pm
by Snooper
Thanks for the replay..

tested.. and.. errrm.. how to put this.. *shruggs* Still starts with a 0 ?!! :D

Re: [HACK] Fixed Shop by Price

Posted: Fri Aug 06, 2010 5:48 pm
by CharlieFoxtrot
Snooper wrote:Thanks for the replay..

tested.. and.. errrm.. how to put this.. *shruggs* Still starts with a 0 ?!! :D
Hmm... that's odd.

I just added that modification to my development site (ISC 4.07) and it works perfectly.

Sorry... maybe the difference in version numbers has something to do with it.

Good luck.

Re: [HACK] Fixed Shop by Price

Posted: Fri Aug 06, 2010 8:59 pm
by Snooper
I have no idea c/fox.. Only the fact nothing works !!!

Under the line ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {

I have the following

Code: Select all

$row = $GLOBALS['ISC_CLASS_DB']->fetch($result);
		if(!$row) {
			$this->DontDisplay = true;
			return;
		}

		$min = ceil($row['pmin']);
		$max = ceil($row['pmax']);
Making the mod so that min = £5 and max = £100 for example.

Code: Select all

$row = $GLOBALS['ISC_CLASS_DB']->fetch($result);
		if(!$row) {
			$this->DontDisplay = true;
			return;
		}

		$min = 5;
		$max = 100;
I then mod the lines --

$diff = (($max - $min) / 5);

for ($i = 0; $i < 5; $i++) {


So they refer to only 4 steps of incrimination not 5..
This works, but starts with £0.00 - £24.00
I add your line by the swap you gave.. and get the same presentational result as above.

Attached is my PHP script.. you can see what may have changed… http://www.ihost4u.co.uk/inter/SideCate ... yPrice.zip

Otherwsie, good of you to have given this a shoot for me..

Re: [HACK] Fixed Shop by Price

Posted: Fri Aug 06, 2010 9:04 pm
by CharlieFoxtrot
Just a shot in the dark... for the replacement string, try using "£0.00" instead of "$0.00".

Re: [HACK] Fixed Shop by Price

Posted: Fri Aug 06, 2010 9:16 pm
by Snooper
perfect !!

brill stuff.. ty c/fox..