zlack Posted December 13, 2002 Share Posted December 13, 2002 Hello all, I have a little problem: I got 2 products 1. Article worth ? 200 2. Article worth discount ? 300 when the customer selects both, then the price is negative atm. but I want it to be zero every time when something is lower then zero. Anyone got the sollution for me how to add/modify code to fix my problem? It's easier to remember, then to forget Link to comment Share on other sites More sharing options...
Christian Lescuyer Posted December 13, 2002 Share Posted December 13, 2002 You'll have to hack the code in the shopping cart and checkout pages. Add something as $price = max($price, 0); after the price calculation. Christian Lescuyer Link to comment Share on other sites More sharing options...
zlack Posted December 20, 2002 Author Share Posted December 20, 2002 Thanks for your reply, but...... i'm very bad in coding php :cry: Could you be more specific in where i have to change what? Thanks alot! It's easier to remember, then to forget Link to comment Share on other sites More sharing options...
Christian Lescuyer Posted December 23, 2002 Share Posted December 23, 2002 Look in includes/classes/order.php Locate the line $this->info['subtotal'] += $shown_price; Just below, add: $this->info['subtotal'] = max($this->info['subtotal'], 0); I have not actually tried it. Christian Lescuyer Link to comment Share on other sites More sharing options...
zlack Posted December 23, 2002 Author Share Posted December 23, 2002 thanks allot! the only problem left is that in the shopping cart and in the product listing it has to be zero as well. do you have another line of code to fix that as well ? It's easier to remember, then to forget Link to comment Share on other sites More sharing options...
Christian Lescuyer Posted January 6, 2003 Share Posted January 6, 2003 Did you solve it or are you still stuck? Christian Lescuyer Link to comment Share on other sites More sharing options...
zlack Posted January 7, 2003 Author Share Posted January 7, 2003 well, i'm still stuck in this issue. haven't got any time to work on it as well. It's easier to remember, then to forget Link to comment Share on other sites More sharing options...
Christian Lescuyer Posted January 7, 2003 Share Posted January 7, 2003 the only problem left is that in the shopping cart and in the product listing it has to be zero as well. Did you try and apply the mod? I'd think that applying it to the order class would correct the problem everywhere. Otherwise, can you tell me which pages you mean (file name)? Christian Lescuyer Link to comment Share on other sites More sharing options...
zlack Posted January 7, 2003 Author Share Posted January 7, 2003 I don't know which file it is, but the last problem is this: I got some product with the value -200 But when they are listed in the catagorie(s) then i still see -200 for that product. But that has to be listed as 0 (zero) but still keep the value -200. P.S.: thanks for your fast reply It's easier to remember, then to forget Link to comment Share on other sites More sharing options...
Christian Lescuyer Posted January 7, 2003 Share Posted January 7, 2003 OK. Look at the URL (the address) when you display the page. It should be something as http://www.oscommerce.com/forums/posting.php?mode=reply&t=29402 In that case, the file name is posting.php. It's the name after the last '/' and before the optional '?' As there are prices all over the place, I need to know on which pages the problem occurs. Christian Lescuyer Link to comment Share on other sites More sharing options...
zlack Posted January 9, 2003 Author Share Posted January 9, 2003 I mean just an article. Like i have an HP printer with the value -200, but in the catalog it has to be displayed as 0. But that article has to keep the value -200 cause, in combination with an other article someone has to get some discount. Get my point? I hope i explained it right like this. Thanks in advance, zlack It's easier to remember, then to forget Link to comment Share on other sites More sharing options...
Christian Lescuyer Posted January 9, 2003 Share Posted January 9, 2003 I assume you want to display the price in product_info.php. Look for <?php echo $products_price; ?> in product_info.php (in my file, version 1.87, it's on line 76). Replace with <?php echo max($products_price, 0); ?> Christian Lescuyer Link to comment Share on other sites More sharing options...
zlack Posted January 15, 2003 Author Share Posted January 15, 2003 Well, i think i'm getting crazy over here :-) Take a look at this: http://www.nexio.nl/catalog/product_info.p...roducts_id=2085 You see the price here is -119 And i added you code, but its still -119 :-( Got the answer for me? Thanks alot It's easier to remember, then to forget Link to comment Share on other sites More sharing options...
zlack Posted January 15, 2003 Author Share Posted January 15, 2003 I think the problem is also in product_listing.php in the modules dir. Thanks It's easier to remember, then to forget Link to comment Share on other sites More sharing options...
Christian Lescuyer Posted January 15, 2003 Share Posted January 15, 2003 I'm afraid the price will appear all over the place :( One way to proceed is to search files with "price" in them. You can do this with grep in Unix, or with the search tool in Windows. Look for *.php containing "price". Unfortunately, you'll get quite a lot. Christian Lescuyer Link to comment Share on other sites More sharing options...
zlack Posted January 16, 2003 Author Share Posted January 16, 2003 well, since i ain't wanna mess with my running site i guess this is the end for me :( but maybe you can handle me another sollution since the products only have to be in 1 categorie? i just need one categorie with these products, and maybe its easy to solve it with another way? thanks It's easier to remember, then to forget Link to comment Share on other sites More sharing options...
Christian Lescuyer Posted January 16, 2003 Share Posted January 16, 2003 well, since i ain't wanna mess with my running site i guess this is the end for me :( It is a very good idea not to mess with a running site. But you could also install a copy of your site on your local computer with easyPHP, test your solution and load it on your production site when you're done. but maybe you can handle me another sollution since the products only have to be in 1 categorie?i just need one categorie with these products, and maybe its easy to solve it with another way? No, it doesn't change the problem. I beleive that if you were successful with one page, it's only a matter of patience to get it done all over the place. Christian Lescuyer Link to comment Share on other sites More sharing options...
zlack Posted January 16, 2003 Author Share Posted January 16, 2003 Do you know which variabele outputs i have to change? I got a copy running next to my site, and i'm gonna test it there. It's easier to remember, then to forget Link to comment Share on other sites More sharing options...
Christian Lescuyer Posted January 16, 2003 Share Posted January 16, 2003 Browse the site. On every page where the price appears, look at the URL in the address bar. The last part before the '?' is the filename. Eg. in http://www.oscommerce.com/forums/posting.php?mode=reply&t=29402 the filename is posting.php. Open that file in a text editor, look for the price variable (usually called $products_price but it might also be in an array as in $random_product['products_price']). Then apply the max(0, price) trick. If you have problems on a specific page, shout :P Christian Lescuyer Link to comment Share on other sites More sharing options...
zlack Posted January 17, 2003 Author Share Posted January 17, 2003 ok i will start this little project 8) hope it will work thanks alot for all your help so far. It's easier to remember, then to forget Link to comment Share on other sites More sharing options...
Christian Lescuyer Posted January 17, 2003 Share Posted January 17, 2003 Actually, dolby had a much better idea in another thread: change the display_price() function in class currencies.php! Christian Lescuyer Link to comment Share on other sites More sharing options...
zlack Posted January 17, 2003 Author Share Posted January 17, 2003 will that solve it? It's easier to remember, then to forget Link to comment Share on other sites More sharing options...
Christian Lescuyer Posted January 17, 2003 Share Posted January 17, 2003 Yes, I think so. Prices should never be displayed by a simple "echo" but always using the class. Christian Lescuyer Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.