Genius Posted March 16, 2004 Share Posted March 16, 2004 Please can someone help me with the correct syntax code.... I am using the individual shipping contribution and What i want to say is use the first highest shipping rate and then use the second shipping rate for the rest of the products. ( this must only use 1 Frist shipping rate and the highest) the code is: if ($qty > 1 AND shiptotal == $products_ship_price) { $this->shiptotal += ($products_ship_price_two * ($qty-1)); } else { $this->shiptotal += ($products_ship_price * ($qty-1)); } many thanks Link to comment Share on other sites More sharing options...
♥yesudo Posted March 16, 2004 Share Posted March 16, 2004 Try: if (($qty > 1) AND (shiptotal == $products_ship_price)) { $this->shiptotal = ($products_ship_price_two * ($qty-1)); } else { $this->shiptotal += ($products_ship_price * ($qty-1)); } Your online success is Paramount. Link to comment Share on other sites More sharing options...
♥yesudo Posted March 16, 2004 Share Posted March 16, 2004 No this: if (($qty > 1) AND (shiptotal == $products_ship_price)) { $this->shiptotal = ($products_ship_price_two * ($qty-1)); } else { $this->shiptotal = ($products_ship_price * ($qty-1)); } Your online success is Paramount. Link to comment Share on other sites More sharing options...
Genius Posted March 16, 2004 Author Share Posted March 16, 2004 Hi thanks for the quick response but that did not work.. I have tried to rethink this process and the code below seems right.. but i am getting an extra cost of 0.90 so i would like to say something like if $products_ship_price = 3.5000 THEN products_ship_price SHOULD - 0.9000 ELSE it should carry on as below. $this->shiptotal += ($products_ship_price); if ($qty > 1) { $this->shiptotal += ($products_ship_price_two * ($qty-1)); } else { $this->shiptotal += ($products_ship_price * ($qty-1)); } Link to comment Share on other sites More sharing options...
Genius Posted March 16, 2004 Author Share Posted March 16, 2004 Another attempt at the code,.. not sure thought on the syntax $this->shiptotal += ($products_ship_price); if ($qty > 1) { if ($products_ship_price = 3.5000) { $this->shiptotal = ($products_ship_price - 0.9000); $this->shiptotal += ($products_ship_price_two * ($qty-1)); } else { $this->shiptotal += ($products_ship_price * ($qty-1)); } } Link to comment Share on other sites More sharing options...
♥yesudo Posted March 16, 2004 Share Posted March 16, 2004 $this->shiptotal += ($products_ship_price); if ($qty > 1) { ?if ($products_ship_price == 3.5000) { ? ?$this->shiptotal = ($products_ship_price - 0.9000); ? ?$this->shiptotal += ($products_ship_price_two * ($qty-1)); ?} ?else ?{ ? ?$this->shiptotal += ($products_ship_price * ($qty-1)); ?} } Your online success is Paramount. Link to comment Share on other sites More sharing options...
Genius Posted March 16, 2004 Author Share Posted March 16, 2004 that's a later code that may get close... still need help on this though as it just shows the ship price without subtracting the 0.90 Please could someone help me with this code many thanks if ($qty < 2) { $this->shiptotal += ($products_ship_price); } else { if ($products_ship_price >=3.50) { $products_ship_price = ($products_ship_price - 0.90); } $this->shiptotal = ($products_ship_price); $this->shiptotal += ($products_ship_price_two * ($qty-1)); } Link to comment Share on other sites More sharing options...
♥yesudo Posted March 16, 2004 Share Posted March 16, 2004 prash, i don't think the problem is in this bit of code - what happens to the shiptotal variable after it comes out of the get_shiptotal() function ? Your online success is Paramount. Link to comment Share on other sites More sharing options...
Genius Posted March 17, 2004 Author Share Posted March 17, 2004 This is the function code that i think gets the ship total.. function get_shiptotal() { $this->calculate(); return $this->shiptotal; } Not really sure how it calculates the shiptotal.. my guess would be from the code above.. and from this code $this->shiptotal += ($products_ship_price); Link to comment Share on other sites More sharing options...
Genius Posted March 19, 2004 Author Share Posted March 19, 2004 Please can anyone please help me with the problem above... thanks Link to comment Share on other sites More sharing options...
Genius Posted March 19, 2004 Author Share Posted March 19, 2004 I think i am close but not close enough I have managed to get this $this->shiptotal += ($products_ship_price); if ($products_ship_price = 3.5000) $this->shiptotal = ($products_ship_price - 0.9000); if ($qty > 1) { $this->shiptotal += ($products_ship_price_two * ($qty-1)); } if ($qty > 1) { { $this->shiptotal += ($products_ship_price_two * ($qty-1)); } } but still not getting the correct values Link to comment Share on other sites More sharing options...
Genius Posted March 22, 2004 Author Share Posted March 22, 2004 I have got the difference of 0.90 to work fine which is not calculating for mixed group buying.. but now if you buy from the same group i am getting short of 0.45 and once again stuck.. this i what i have now. $this->shiptotal += ($products_ship_price - 0.45); if ($qty > 1) { $this->shiptotal += ($products_ship_price_two * ($qty-1)); } But what i need to also have is that if you buy from the same group then you must not -0.45 otherwise if your buy mixed products then you can... the original code is.. $this->shiptotal += ($products_ship_price); if ($qty > 1) { $this->shiptotal += ($products_ship_price_two * ($qty-1)); } Any help would be great Link to comment Share on other sites More sharing options...
Genius Posted March 22, 2004 Author Share Posted March 22, 2004 how about if i could say somewhere... like if you buy 2 different products from each group then you should take the highest value price.. Link to comment Share on other sites More sharing options...
Pharkie Posted March 22, 2004 Share Posted March 22, 2004 Genius, Without having time to read and really understand your issue here, I can tell you that: if ($products_ship_price = 3.5000) $this->shiptotal = ($products_ship_price - 0.9000); ..looks wrong. '=' does not say 'equals', it says 'assign the value 3.5000 to $products_ship_price'. What you need is '=='. In ASP = would work, but not in PHP. Hope this helps! Link to comment Share on other sites More sharing options...
Genius Posted March 22, 2004 Author Share Posted March 22, 2004 Thank you , much apprecited a step closer... now i need to figure out how to minus an amount if $product_ship_price is 3.50. Link to comment Share on other sites More sharing options...
Pharkie Posted March 22, 2004 Share Posted March 22, 2004 That would be if ($products_ship_price == 3.5000) $this->shiptotal = ($this->shiptotal - 0.9000); ? Link to comment Share on other sites More sharing options...
Genius Posted March 22, 2004 Author Share Posted March 22, 2004 Hey Parkie, Thank you for guiding me in the right direction, as i have accomplished part of what i wanted to acheive... I have managed to get the correct prices for my shipping though had to make a change in the code instead of if ($products_ship_price == 3.5000 this is what it should have been if ( $this->shiptotal == 3.5000 as it collects the shiptotal.. I want to really thank you for your help and really do appreciate it... Although i have cheated and made a quick solution i know i should not really put the static figures in, as it only works in the default country zone. this calculation works for the individual shipping module... but if i have international zone.. i have different shipping rates and i will have to takle that too, but for the time being this works for local... now to the next stage for international... many thanks again :) Link to comment Share on other sites More sharing options...
Genius Posted April 26, 2004 Author Share Posted April 26, 2004 HI there, I am just trying to figure how to use this system with international rates.. basically as it stands it works great if you are in the default country.. but i need to have this same method to have different rates if you are in another country other than the default.. currently i have 2 groups of products and each product have a 1st ship rate and 2nd ship rate... i need to have 2 more rate for the international so Group A international will have 1st and 2nd ship rate and so will Group B international. Is there any way to get this work like that. thanks Link to comment Share on other sites More sharing options...
Pharkie Posted April 26, 2004 Share Posted April 26, 2004 arg brain hurts. Try and do it and paste your code and maybe I could see what's wrong with what you have rather than try and figure it out. Tho there may be a contribution that handles this better. But there probably isn't.. this is too specifically different i think. Good luck with it! Link to comment Share on other sites More sharing options...
Genius Posted April 27, 2004 Author Share Posted April 27, 2004 Thanks Adam, I will try and rack my brains out here and see how far i get.. Link to comment Share on other sites More sharing options...
Genius Posted May 4, 2004 Author Share Posted May 4, 2004 HI adam, not getting any joy just can't get it work with what i need... any sugestions.. i tried looking at extraship module but not luck on that end... Link to comment Share on other sites More sharing options...
Pharkie Posted May 4, 2004 Share Posted May 4, 2004 Hi Prash, The only way I could help would be if you have a specific question on some code that isn't quite working, or at least some sort of framework within a specific file that I could help you develop. Otherwise it needs too much thinking about for me to be much use right now! Maybe someone else could help? Best of luck with it tho, hope you get sorted soon.. Adam Link to comment Share on other sites More sharing options...
Genius Posted May 4, 2004 Author Share Posted May 4, 2004 Hi Adam. Thanks for all your help.. i'll give it another bash and see how i go.. Link to comment Share on other sites More sharing options...
Genius Posted May 6, 2004 Author Share Posted May 6, 2004 Hi Adam, just to let you know that i have accomplished what i wanted.. I have manged to get it sorted and to work with the different ship rates plus with the zones. thanks for you help. All i did was i recreated that same contribution and code and renamed the international rates.. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.