Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Visitor controlled Products displayed per page with STS4


Nacman

Recommended Posts

Hi everyone,

 

I have been slowly learning STS and wanted to report on something I have been working on.

The store owner requested I make the number of products displayed in her website be selectable

by the visitor.

 

My initial thought was to just do an SQL update based on the amount the user wanted to display.

DOH! I quickly realized this would change it for everyone, then envisioned "display war" if the

site ever got busy.

 

So then I went about modifying the variable that reads the database for that info.

This is what I have come up with so far...

 

This makes no database changes, it just ignores what is set in ADMIN and lets the user decide.

Every user gets their own choice too. Initially it is set to 12 products on the page.

 

http://creativenestings.com/osc22rc1/catal...ex.php?cPath=22

 

I have it set up for only this category. I am in the final testing stages looking for bugs.

If all goes well I will add it to the rest of my site and then put it up in a contrib.

 

Since I am a NOOB at php and STS, I am sure there is a better way to implement this

but currently it requires php code (less than 5 lines) to be placed at the beggining of each template file you use

i.e. ***.php.html and modification of product_listing.php with a replacement variable.

 

You will of course have to build the FORM and SUBMIT buttons to suit your needs.

This is totally customizable if it proves to not be buggy.

 

Remember this is ONLY working for the one catagory for now.

 

Feedback appreciated.

 

Nacman

Link to comment
Share on other sites

Hi everyone,

 

I have been slowly learning STS and wanted to report on something I have been working on.

The store owner requested I make the number of products displayed in her website be selectable

by the visitor.

 

My initial thought was to just do an SQL update based on the amount the user wanted to display.

DOH! I quickly realized this would change it for everyone, then envisioned "display war" if the

site ever got busy.

 

So then I went about modifying the variable that reads the database for that info.

This is what I have come up with so far...

 

This makes no database changes, it just ignores what is set in ADMIN and lets the user decide.

Every user gets their own choice too. Initially it is set to 12 products on the page.

 

http://creativenestings.com/osc22rc1/catal...ex.php?cPath=22

 

I have it set up for only this category. I am in the final testing stages looking for bugs.

If all goes well I will add it to the rest of my site and then put it up in a contrib.

 

Since I am a NOOB at php and STS, I am sure there is a better way to implement this

but currently it requires php code (less than 5 lines) to be placed at the beggining of each template file you use

i.e. ***.php.html and modification of product_listing.php with a replacement variable.

 

You will of course have to build the FORM and SUBMIT buttons to suit your needs.

This is totally customizable if it proves to not be buggy.

 

Remember this is ONLY working for the one catagory for now.

 

Feedback appreciated.

 

Nacman

I went to the site and I'm assuming that the upper-right "select how many rows to display" is what we are discussing here.

 

I tried it and it did not change anything. Maybe you have it turned off??

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Link to comment
Share on other sites

I went to the site and I'm assuming that the upper-right "select how many rows to display" is what we are discussing here.

 

I tried it and it did not change anything. Maybe you have it turned off??

 

 

Funny thing Bill,

 

I just got to work, I work nights, so I didn't have a chance to post earlier. This worked PERFECTLY in both IE7 and FF browsers till this morning.

Now it STILL works in FF but not in IE7 anymore. What is even crazier, is it doesn't work in ANY IE7 browser anymore. I just tried here at work,

and it doesn't work here either, but FF works here as well.

 

I am using session_start() and $_session to get at the user selected input. For the life of me, I can't understand why it worked

yesterday in IE7 but not today, but continues to work in FF.

 

If you or anyone reads this, can they verify FF handling this.......and if anyone can offer any ideas as to why the session writes aren't happening in IE7 all of a sudden, please post here. Always something to learn :)

 

Nacman

Link to comment
Share on other sites

I went to the site and I'm assuming that the upper-right "select how many rows to display" is what we are discussing here.

 

I tried it and it did not change anything. Maybe you have it turned off??

 

 

After a lot of hair pulling out, thinking I was losing my mind, I decided to change

from using an image for the submit buttons, back to the way it was originally.

 

<input type="image" src="images/site/2.gif" name="2" value="2"> DOESN"T WORK IN IE7

if you use and image type as a submit button, it doesn't submit the values!!!

 

If you change it to

<input type="submit" name="1" value="1" > ALL works again, albeit with big buttons.

 

I have confirmed this is a BUG in IE7 only....

 

Have a try now :)

 

Nacman

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...