citabriabob 8 Posted January 29 Share Posted January 29 Using Estelles Winterflood's All-in-one shipping, I would like to eliminate all shipping prices for two products, as they are membership fees. Thanks you, Quote Link to post Share on other sites
bsmither 1,460 Posted January 29 Share Posted January 29 Would these actually be considered digital products? To make them digital, the product need only have a downloadable document associated with it, either from the File Picker, or a specific URL in the text box below the picker. The document could be a simple text file, image, or PDF, that serves as a membership certificate. Quote Link to post Share on other sites
citabriabob 8 Posted January 29 Author Share Posted January 29 (edited) No. The two items are Club Memberships and have no digital content. I thought about faking this, but that might raise more questions... Edited January 29 by citabriabob Quote Link to post Share on other sites
bsmither 1,460 Posted January 29 Share Posted January 29 I would think (based on my selling memberships via CC3 in another life) that memberships would have no physical content. Please let us know what it is about these products that you think are causing AIOS to come back with a shipping rate. And is AIOS the only shipping module you are using? Anyway, I would like to solve this. AIOS does not iterate through the order's product list, but will count the number of items and could make rate calculations based on that. Quote Link to post Share on other sites
citabriabob 8 Posted January 29 Author Share Posted January 29 You are right; there is nothing to ship nor download. Still have to have a quantity (1) to do the pricing, so that sets AIOS up for shipping cost. Thanks. Quote Link to post Share on other sites
bsmither 1,460 Posted January 30 Share Posted January 30 That suggests that you have AIOS set, in the "Show advanced settings", the "Per item component" checkbox. Or, "Total quantity-based rates" in the Main Settings is checked. This could be because there are other products that, for reasons that are necessary to your business model, do require shipping based on how many things are in the order. I'm going through the AIOS code, but in the meantime, maybe this will be of interest: https://www.cubecart.com/extensions/shipping-methods/link-cubecart-products-to-specific-shipping-services-/-modules According to the description, you can assert these two products will use another module - perhaps the Free Shipping module, or the Per Category module - where all other items in the order will use the default shipping module. You should ask the developer of that module for more details. Quote Link to post Share on other sites
bsmither 1,460 Posted January 30 Share Posted January 30 (edited) Do these particular membership products, and only these products, belong to the same category? If so, then in the AIOS shipping file shipping.class.php, near line 46: $this->_item_count = 0; if(isset($this->_basket['contents']) && is_array($this->_basket['contents'])) { foreach ($this->_basket['contents'] as $item) { // XXX May want to exclude digital products from the item count, i.e. // if ($item['digital']) continue; $this->_item_count += $item['quantity']; } } We can use the appropriate line to test if $item['cat_id'] == 6 (or whatever) to skip over counting that item from the items in the cart. Edit: We cannot use 'cat_id' as this detail is not made available in the _basket['contents']. Edited Saturday at 06:43 PM by bsmither Quote Link to post Share on other sites
citabriabob 8 Posted Friday at 10:42 PM Author Share Posted Friday at 10:42 PM OK, here is what I added; $this->_item_count = 0; foreach ($this->_basket['contents'] as $item) { // XXX May want to exclude digital products from the item count, i.e. // if ($item['digital']) continue; // RS-Mod 2/19/21 exclude memberships from item count $item['cat_id'] == 4 continue; $this->_item_count += $item['quantity']; } Now it dies when trying to check out. Calls for https, so that isn't the problem... Did I scew up the modification? Never mind; found my error: s/b // RS-Mod 2/19/21 exclude memberships from item count if ($item['cat_id'] == 4) continue; Quote Link to post Share on other sites
citabriabob 8 Posted Friday at 11:02 PM Author Share Posted Friday at 11:02 PM Still another change: // RS-Mod 2/19/21 exclude memberships from item count if ($item['cat_id'] == 4) {continue;} Not working (still counts category 4 items) Quote Link to post Share on other sites
citabriabob 8 Posted Saturday at 05:53 PM Author Share Posted Saturday at 05:53 PM Just thinking: Is the cat_id in the $item at this point? Seems like it's in the product data... Quote Link to post Share on other sites
bsmither 1,460 Posted Saturday at 06:33 PM Share Posted Saturday at 06:33 PM I think I discovered it is not. If not, we will have to put it in, or test for something else. The CubeCart programmers, for reasons that escape me, programmed a number of queries to return an enumerated list of details, as opposed to everything in the record. I'm looking at this closer. Would the target items have a specific Product Code prefix? I suppose they do not have any weight. This is what we have to work with: 'id' => 1 'quantity' => 1 'digital' => 0 'cost_price' => 0 'option_line_price' => 0 'total_price_each' => 6.99 'description' => This is the main copy for the product. 'name' => Test Product 1 'product_code' => TESA31 'product_weight' => 0 'product_width' => 0.0000 'product_height' => 0.0000 'product_depth' => 0.0000 'tax_each' => 'option_absolute_price' => (Earlier, I was using an installation I had modified to put a lot more of the product's details in the basket, from a separate project.) Quote Link to post Share on other sites
citabriabob 8 Posted Saturday at 06:49 PM Author Share Posted Saturday at 06:49 PM 1 minute ago, bsmither said: thing in Is there a "file layout" for $item? and other strings/arrays? Quote Link to post Share on other sites
bsmither 1,460 Posted Saturday at 07:04 PM Share Posted Saturday at 07:04 PM Please elaborate. What are you thinking of doing? Quote Link to post Share on other sites
citabriabob 8 Posted Saturday at 11:12 PM Author Share Posted Saturday at 11:12 PM Just trying to see were all this is going. Used to be a Systems Analyst with Cobol etc. Quote Link to post Share on other sites
citabriabob 8 Posted Monday at 07:23 PM Author Share Posted Monday at 07:23 PM Very hard for an old procedural programmer to deal with PHP; trying to make sense of all the code. Not trying to build anything new. Thanks. Quote Link to post Share on other sites
shubharora734 0 Posted Tuesday at 09:56 AM Share Posted Tuesday at 09:56 AM (edited) I would think (based on my selling memberships via CC3 in another life) that memberships would have no physical content. Please let us know what it is about these products that you think are causing AIOS to come back with a shipping rate. And is AIOS the only shipping module you are using? . Edited Tuesday at 02:54 PM by shubharora734 Quote Link to post Share on other sites
citabriabob 8 Posted Tuesday at 02:18 PM Author Share Posted Tuesday at 02:18 PM (edited) You are correct. Problem is that the item is counted for AIOS shipping, which is based on total quantities; there are 3 qty ranges and it overprices. Edited Tuesday at 02:19 PM by citabriabob Quote Link to post Share on other sites
citabriabob 8 Posted Tuesday at 08:52 PM Author Share Posted Tuesday at 08:52 PM Both products in question begin with "M"; is the product code available in $item? Quote Link to post Share on other sites
bsmither 1,460 Posted Tuesday at 09:38 PM Share Posted Tuesday at 09:38 PM Yes. But be aware that when using the product's Options Matrix table, there will be the opportunity to create arbitrary product codes. CubeCart automatically creates a product code in this table constructed from the product code of the base product, then appends -##. Perhaps not applicable to your situation, but something to be aware of. Quote Link to post Share on other sites
citabriabob 8 Posted Tuesday at 09:53 PM Author Share Posted Tuesday at 09:53 PM Does this look good? if startsWith($item['product_code'] == "M") continue Quote Link to post Share on other sites
bsmither 1,460 Posted Tuesday at 11:40 PM Share Posted Tuesday at 11:40 PM if (substr($item['product_code'],0,1) == 'M') continue; The 'startsWith' is expressed as a substring that starts at zero for 1 character. Let's give it a try. Quote Link to post Share on other sites
citabriabob 8 Posted 19 hours ago Author Share Posted 19 hours ago No, still not working. Have to let this sleep while I try to finish the rest of the project and get it online. Thanks for your help. Quote Link to post Share on other sites
citabriabob 8 Posted 13 hours ago Author Share Posted 13 hours ago (edited) On 1/29/2021 at 7:50 PM, bsmither said: Do these particular membership products, and only these products, belong to the same category? If so, then in the AIOS shipping file shipping.class.php, near line 46: $this->_item_count = 0; if(isset($this->_basket['contents']) && is_array($this->_basket['contents'])) { foreach ($this->_basket['contents'] as $item) { // XXX May want to exclude digital products from the item count, i.e. // if ($item['digital']) continue; $this->_item_count += $item['quantity']; } } We can use the appropriate line to test if $item['cat_id'] == 6 (or whatever) to skip over counting that item from the items in the cart. Edit: We cannot use 'cat_id' as this detail is not made available in the _basket['contents']. Final (I hope) issue is that having disabled the mailing list in the trailer, there is still a "Subscribe to mailing list" under the Billing Address question on the Basket. When clicked on, the error: "The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later. Additionally, a 503 Service Unavailable error was encountered while trying to use an ErrorDocument to handle the request." If not clicked, all is normal to checkout. https://typeclubs.org/aac-toc-cc Edited 12 hours ago by citabriabob Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.