Challenges on the osCommerce Forum

By | February 13, 2013

Quite often, in the osCommerce forum, I state my idea about something and am usually challenged by someone or other to show that what I have said can be done, can be done.

I must admit that sometimes what I come up with in theory, cannot be done as easily in practice. Here’s a couple of recent examples…

1. Making osCommerce invisible (link)

I have a page filled with images (and nothing else). User clicks on as many images as he wants and that makes (with help of javascript) changes to an invisible form. The form then gets submitted and all the selected products are inserted to the osCommerce system. In other words, can I insert several products from a html form to osCommerce all at once?

My answer was “yes”, as I have recently coded up a system that allows this. With some extra changes and some .js trickery, we cna show just the image, and have the image clickable to update the “count” to be purchased.

2. Hidden Price Module (link)

I need a way to hide the pricing of specific products on my site. Rather than show pricing, it should read something like add to cart to see pricing. Once the item has been added to the cart, the pricing should be visible

I thought (with thinking nor readin the question properly) that this could be done in 1 line of code. My general idea was to amend the display_price function in the currency class file. Of course, this would work for removing pricing across the entire site, with prices shown in the shopping_cart.php listing. Just return “NULL” or such in the display_price function.

Then I was reminded that the original poster needs to do this for some products and not others. To enable this is a lot more difficult;

1. We need to be able to choose the products to not have the price displayed. This is similar to the admin function of my HAZMAT module. We’ll call this the “no display products”.
2. We need to be able to compare the product being displayed with the “no display products” & be able to remove the pricing for the “no display products” – this requires a change across multiple files to allow the passing of the product_id thru the display_price function. Then we can do some magic in the currencies class file based on the product id.

All in all, not straightforward. But still do-able, why not?

Leave a Reply

Your email address will not be published.