harlow Posted October 5, 2009 Posted October 5, 2009 I cannot figure out how to exempt items (downloadable software, donations, etc.) from shipping charges. I tried assigning them zero weight and including this in the table mode of shipping, but it refused to let me have a zero shipping cost. I am sure that someone has solved this problem... Please point me to the right way to set this up. It needs to be something that can be set on a per-item basis, since I also sell physical merchandise which does require charges. Thanks
medved Posted October 5, 2009 Posted October 5, 2009 it works on my site but i think i already have a contrib for that. you can try to find some contribs for example: http://addons.oscommerce.com/info/3823
FIMBLE Posted October 5, 2009 Posted October 5, 2009 The code to handle this is already in osC (checkout_shipping.php), do you have downloads enabled in admin / configuration / downloads? // if the order contains only virtual products, forward the customer to the billing page as // a shipping address is not needed if ($order->content_type == 'virtual') { if (!tep_session_is_registered('shipping')) tep_session_register('shipping'); $shipping = false; $sendto = false; tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); } Nic Sometimes you're the dog and sometimes the lamp post [/url] My Contributions
harlow Posted October 5, 2009 Author Posted October 5, 2009 The code to handle this is already in osC (checkout_shipping.php), do you have downloads enabled in admin / configuration / downloads? // if the order contains only virtual products, forward the customer to the billing page as // a shipping address is not needed if ($order->content_type == 'virtual') { if (!tep_session_is_registered('shipping')) tep_session_register('shipping'); $shipping = false; $sendto = false; tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); } Nic I confess to total ignorance of the download feature. The code you cite is there in my installation, but how do you designate a product as "virtual"? I don't see any sort of link or setting that specifies this. Thanks
♥ecartz Posted October 6, 2009 Posted October 6, 2009 The short answer is that you do so in admin >> Catalog >> Product Attributes. If you look in the root of the distribution directory (what you downloaded, not what you uploaded; you can get a new copy by clicking Website at the top of this page, then Solutions, then Download), there should be two documentation PDFs. Look in those for the section corresponding with http://www.oscommerce.info/kb/osCommerce/Administration_Tool/Configuration/162 -- which is the documentation for the next version of osCommerce and may or may not correspond with the current version. Always back up before making changes.
harlow Posted October 6, 2009 Author Posted October 6, 2009 The short answer is that you do so in admin >> Catalog >> Product Attributes. If you look in the root of the distribution directory (what you downloaded, not what you uploaded; you can get a new copy by clicking Website at the top of this page, then Solutions, then Download), there should be two documentation PDFs. Look in those for the section corresponding with http://www.oscommerce.info/kb/osCommerce/Administration_Tool/Configuration/162 -- which is the documentation for the next version of osCommerce and may or may not correspond with the current version. OK, I think I am beginning to understand. The Download thing has to do with downloading software products, not updates to the OSCommerce system. Got that... What do you do with "products" like donations? There is nothing to download, but there are also no physical goods to ship. How do you set things up for that scenario?
♥ecartz Posted October 7, 2009 Posted October 7, 2009 The easy way is to create a dummy file for download. For example, for a donation, you might create a small text file that says something like "Thank you for your donation. We really appreciate it." A more complicated way would be to modify the code to recognize that donations are virtual but not downloadable. The CCGV contribution does this by making 0 weight products virtual. Always back up before making changes.
medved Posted October 10, 2009 Posted October 10, 2009 In order to calculate the shipping correctly and charge the customer the right value of shipping goods MS2.2 relies on the shipping module itself to generate the quote. The stock modules do not take weight into account but with few simple code modifications this can be easily achieved. The following example modifies one of the simplest shipping modules in MS2.2 to demonstrate this. In catalog/includes/modulesshipping/item.php locate this code: function quote($method = '') { global $order, $total_count; $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_ITEM_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_ITEM_TEXT_WAY, 'cost' => (MODULE_SHIPPING_ITEM_COST * $total_count) + MODULE_SHIPPING_ITEM_HANDLING))); change it to: function quote($method = '') { global $order, $total_count; $weight_items = 0; for($i=0, $j=count($order->products); $i<$j; $i++) { if( $order->products[$i]['weight'] > 0 ) { $weight_items++; } } $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_ITEM_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_ITEM_TEXT_WAY, 'cost' => (MODULE_SHIPPING_ITEM_COST * $weight_items) + MODULE_SHIPPING_ITEM_HANDLING))); The above code basically takes into account the weight variable as it is kept by the temporary order class. When the weight of a product is greater than 0 the item is present for shipping calculations.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.