Madbits Posted July 27, 2020 Posted July 27, 2020 Hi there, I need a solution to be able to sell products per linear meter, of course when increasing the length in meters the price should increase as well. I am willing to try and implement it myself as a module if needed, I just need a little bit of guidance as in where I should look into as a first step to get started. Is there any free module already doing this? Cheers.
The Pellet Guy Posted July 27, 2020 Posted July 27, 2020 Could you not set this up in combinations? Set up your attribute then add values for that attribute like 1m 1.5m 2m 2.5m or is the product sold in very random lengths? once you have set them up you can then do an increase price per value from the product combinations tab
Madbits Posted July 27, 2020 Author Posted July 27, 2020 (edited) 22 minutes ago, The Pellet Guy said: Could you not set this up in combinations? Set up your attribute then add values for that attribute like 1m 1.5m 2m 2.5m or is the product sold in very random lengths? once you have set them up you can then do an increase price per value from the product combinations tab Oh, indeed, easily done. Any idea if I can replace the dropdown with an incrementing/decrementing button? I should be able to sell between 1 and 20 linear meters, isn't there a method to just limit an incrementing button to 20 or something instead of creating values like: 1m, 1.1m, 1.2m, 1.3m, 1.4m so on and so forth until 20m, which would take quite a lot of time. Edited July 27, 2020 by Madbits
haylau Posted July 27, 2020 Posted July 27, 2020 Perhaps it may be about what you are selling. Some of our products we sell by the meter but we keep it very simple. it is a single item, and the title says sold per meter, and the descritption tells the customer we will send however many they buy in a single length https://u-bolts-r-us.co.uk/stainless-steel-chain-and-rope/10777-2mm-t316-stainless-steel-wire-rope-1x19-strand-sold-per-meter-see-description-5055624422917.html This works for us on our own site, ebay , Amazon etc
Madbits Posted July 27, 2020 Author Posted July 27, 2020 35 minutes ago, haylau said: Perhaps it may be about what you are selling. Some of our products we sell by the meter but we keep it very simple. it is a single item, and the title says sold per meter, and the descritption tells the customer we will send however many they buy in a single length https://u-bolts-r-us.co.uk/stainless-steel-chain-and-rope/10777-2mm-t316-stainless-steel-wire-rope-1x19-strand-sold-per-meter-see-description-5055624422917.html This works for us on our own site, ebay , Amazon etc That would be a solution too, although I am working for a client and just decided to switch over to thirtybees from woocommerce, I would gladly implement the feature myself through PHP, I just have a hard time figuring out the structure of the framework at the moment, if there would be a free module than it would be even better. What I have explained can be easily achieved through woocommerce, didn't expect such product attributes to not be available on prestashop/thirtybees.
haylau Posted July 27, 2020 Posted July 27, 2020 Just read your second post again. You are not selling by meter like we do (so 1 meter, 2 meters, 3 meters etc) but you want options between those, 1.1,1.2,1.3 etc - Only with combinations I am afraid. Read up on it, as the system will allow you to auto generate those combinations (You can also use the Product Combinations Generator in order to automatically create a set of combinations.) The main problem I see with this kind of thing is stock control. If the seller has 10 meters, and sells it in 1.1, 1.2, 1.3 ,meters etc then what happens in this scenario Customer 1 purchases the full 10 meter BUT Customer 2 can still purchase 1.1 meter Until someone (or something) then re-adjusts all the stock values of the combinations
Wartin Posted July 27, 2020 Posted July 27, 2020 2 hours ago, Madbits said: I should be able to sell between 1 and 20 linear meters, isn't there a method to just limit an incrementing button to 20 or something instead of creating values like: 1m, 1.1m, 1.2m, 1.3m, 1.4m so on and so forth until 20m, which would take quite a lot of time. Hello. If you do have to do it with combinations, you can create the combinations from CSV importing. With libreoffice Calc (or excel, for the case), you can write 1.1 1.2 1.3, select all and then drag down until 20 (it adds 0.1 in each row). Then you have to add :0. :1, for the position. I send you a file. In weight you can add the same amount for each step, and the price makes jumps too. combinations-length.csv
Traumflug Posted July 27, 2020 Posted July 27, 2020 4 hours ago, Madbits said: I should be able to sell between 1 and 20 linear meters, isn't there a method to just limit an incrementing button to 20 Fractional quantities are not supported, AFAIK. But one can sell single centimeters, then let the customer adding such centimeters using the up/down button. Tweaks, like starting with 100 cm or adding 10 cm per click or displaying 100 cm as 1.0 m are a matter of JavaScript in the theme (product page, checkout page). This leaves just one issue open: a customer wanting two lengths in one order. E.g. a piece with 150 cm as well as a piece with 200 cm. Shop logic would join this to one piece of 350 cm. Other than this it should work well.
Madbits Posted July 27, 2020 Author Posted July 27, 2020 (edited) 2 hours ago, Traumflug said: Fractional quantities are not supported, AFAIK. But one can sell single centimeters, then let the customer adding such centimeters using the up/down button. Tweaks, like starting with 100 cm or adding 10 cm per click or displaying 100 cm as 1.0 m are a matter of JavaScript in the theme (product page, checkout page). This leaves just one issue open: a customer wanting two lengths in one order. E.g. a piece with 150 cm as well as a piece with 200 cm. Shop logic would join this to one piece of 350 cm. Other than this it should work well. Basically at the moment, from what I can see while looking into product.tpl, I will need to implement at a core level a new group_type into $group, currently looking where $group is defined as I have never worked with smarty before. Front-End wouldn't be an issue, the buttons themselves. Edited July 27, 2020 by Madbits
Madbits Posted August 4, 2020 Author Posted August 4, 2020 (edited) * Bump * So far I have done the following: Edit product.tpl and implement 2 buttons around our select element as follows: <div id="minusBtn">-</div> <select name="{$groupName}" id="group_{$id_attribute_group|intval}" class="form-control attribute_select no-print"> {foreach from=$group.attributes key=id_attribute item=group_attribute} <option value="{$id_attribute|intval}"{if (isset($smarty.get.$groupName) && $smarty.get.$groupName|intval == $id_attribute) || $group.default == $id_attribute} selected="selected"{/if} title="{$group_attribute|escape:'html':'UTF-8'}"> {$group_attribute|escape:'html':'UTF-8'}</option> {/foreach} </select> <div id="plusBtn">+</div> Then changed their style in product.css so they would look nicer. Then implemented some custom JS into Custom Code as follows: the following JS code: var count = 1 document.getElementById('plusBtn').addEventListener('click', function() { if(count < document.getElementById('group_1').options.length) { count++ document.getElementById('group_1').value = count } else { document.getElementById('group_1').value = 5 } }) document.getElementById('minusBtn').addEventListener('click', function(){ if(count > 1){ count-- document.getElementById('group_1').value = count } else{ document.getElementById('group_1').value = 1 } }) Now issue is that this will use the code on all pages, something which I do not desire, I only want this piece of code on Product.tpl page, although adding it as in <script> tags, crashes the site(error 500). Besides that, the price does not increase as in when chosing the option from the select element like a dropdown( this product has a combination list that impacts the price ) and when adding the product to cart, it does not add the chosen option, but the default one, as if it wasn't even chosen to begin with. Edited August 4, 2020 by Madbits
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now