Create one age with on-sale products

Modules, Add-ons and custom code that's more than just a quick hack or Mod.
mozack
Posts: 27
Joined: Tue Mar 30, 2010 2:32 pm

Create one age with on-sale products

Post by mozack »

Hi,

Anyone know hot to crate one single page with products that have price reduction?

I want to show all products from every category showing only product with reduction of price

If someone can help me...

Thanks

Mozack

Mod Note: Title modified to remove ALL CAPS... Don't SHOUT please!...
Tony Barnes
Posts: 744
Joined: Thu Jun 18, 2009 8:59 am

Re: Create one age with on-sale products

Post by Tony Barnes »

You would need to copy includes/display/CategoryContent.php, call it something like CategorySaleContent.php. Go to line 14 and change it from $GLOBALS['ISC_CLASS_CATEGORY']->GetProducts($products); to $GLOBALS['ISC_CLASS_CATEGORY']->GetSaleProducts($products);

Open up includes/classes/class.category.php, find the references to the GetProducts() function, and copy/paste as GetSaleProducts() - but removing any category restrictions so $sql = 'p.prodvisible=1 AND ca.categoryid IN ('.$this->GetProductCategoryIds().')'; would become $sql = 'p.prodvisible=1 IN ('.$this->GetProductCategoryIds().')';

You would then need to put in some other logic to only pull the sale ones through, so $sql = 'p.prodvisible=1 IN ('.$this->GetProductCategoryIds().')'; would now become $sql = 'p.prodvisible=1 AND p.prodprice<p.prodretailprice IN ('.$this->GetProductCategoryIds().')';

Copy the categorycontent.html panel as categorysalecontent.html, and then call the panel with %%Panel.CategorySaleContent%% in a new category.html saved as _category.html that you have selected for use as your sale category in the backend.

Should work, or be at least part way there for you :)
mozack
Posts: 27
Joined: Tue Mar 30, 2010 2:32 pm

Re: Create one age with on-sale products

Post by mozack »

Hi, thanks!

I'll try it...

And i will post the results here...

Thanks

Mozack
mozack
Posts: 27
Joined: Tue Mar 30, 2010 2:32 pm

Re: Create one age with on-sale products

Post by mozack »

Hi,

I try your code but i only get one blank page... Why?

Dont appear anything just a blank page

If you can help me...


Thanks

Mozack
Tony Barnes
Posts: 744
Joined: Thu Jun 18, 2009 8:59 am

Re: Create one age with on-sale products

Post by Tony Barnes »

Did you create the _category.html and select that ok?
mozack
Posts: 27
Joined: Tue Mar 30, 2010 2:32 pm

Re: Create one age with on-sale products

Post by mozack »

yes,

a create a new category and i choose the template to _category.html. My question is about the class.category, i need to make some changes there but i save the file with the some name (overwrite)? And i need to copy paste functions and tchange from GetProducts to GetSaleProducts?

Well if i'm doing everything alright it dont show the category...

But i have to ask some more things about this mod....

I need to change the product (in backoffice) and change or add to the category with template _category.html, right?

Can it be done without changing the products in backoffice? Ex.: If one product goes to onsale it appear in this category. Well, we have the bulk edit option to change it but my point is 1 page with all onsale products without changing the categories, etc.. And block the address of this page in robots to avoid duplicate content

Thanks for your help...

Regards
Tony Barnes
Posts: 744
Joined: Thu Jun 18, 2009 8:59 am

Re: Create one age with on-sale products

Post by Tony Barnes »

Just looked at my first reply, you will have to edit the top of the categorycalecontent.php - change CLASS ISC_CATEGORYCONTENT_PANEL extends PANEL to CLASS ISC_CATEGORYSALECONTENT_PANEL extends PANEL

It's something like that - I've never actually had to create a live panel like this, but that is the direction you need to look in
mozack
Posts: 27
Joined: Tue Mar 30, 2010 2:32 pm

Re: Create one age with on-sale products

Post by mozack »

Ok,

Thanks... I'll try again maybe i can put this woking...
Tony Barnes
Posts: 744
Joined: Thu Jun 18, 2009 8:59 am

Re: Create one age with on-sale products

Post by Tony Barnes »

No, this should just pull up any product where the RRP is less than the retail price and stick it in there, so no need for changing the products category.

Yes you will be duplicating information in class.category.php with the minor changes, so overwrite it. Yes, copy all the getproduct stuff, and change to getsaleproduct
Tony Barnes
Posts: 744
Joined: Thu Jun 18, 2009 8:59 am

Re: Create one age with on-sale products

Post by Tony Barnes »

Ok, good luck - the key is getting that new bit of php CategorySaleContent.php to fire up - that's the only bit I've not done before.

If you can't get it going will have to think of a workaround, maybe with hidden divs...?? Dunno!
Post Reply