Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Simple Coding Error, advice needed


zefeena

Recommended Posts

Posted

In order to sell fabric in less than whole metres I’m following this instruction-

 

In includes/classes/shopping_cart.php, around line 125, and a line to quantize $quantity to the increment you want. For me, it was fourths, so I used the formula floor( $quantity * 4 + 0.5) / 4. This rounds to the nearest valid value. If 10cm is your quanta, you could use floor( $quantity * 10 + 0.5) / 10.

 

if (is_numeric($products_id) && isset($this->contents[$products_id_string]) && is_numeric($quantity)) {

New line of code here---> $quantity = floor( $quantity * 4 + 0.5) / 4;

$this->contents[$products_id_string] = array('qty' => $quantity);

 

 

I did this before and it worked great, but then I made a hash of something else and had to reinstall original files, and redo all my changes for other things – product attributes with suffix, main cats on front page, price break. When I’ve come to inputting the code above again, I find my ‘original’ code is not identical to that above I have an extra bit - ($attributes_pass_check == true).

 

Can someone tell me where to insert this bit of code, - $quantity=floor($quantity*10+0.5)/10;

 

taking into consideration my extra bit. I tried putting it in after all the code below and that doesn’t work! I don’t understand coding at all!

 

My coding says-

 

if (is_numeric($products_id) && isset($this->contents[$products_id_string]) && is_numeric($quantity) && ($attributes_pass_check == true)) {

 

thank you!

Running a botched up version of  osCommerce Online Merchant v2.3.4 bootstrap with the dresscode theme installed, numerous add-ons, terrible coding, terrible website, but will have to make do until I have made up for my losses and can risk shutting down for a couple of weeks while I start all over again. - I did not install my program but am endeavouring to fix it with your help.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...