Mark C Posted July 19, 2022 Share Posted July 19, 2022 On the guest and customer's view, the product page will show "The minimum purchase order quantity for the product is xxxx." How can i append a unit like Liters or pcs so it will look like "The minimum purchase order quantity for the product is xxxx Liters." ? thanks Link to comment Share on other sites More sharing options...
lordignus Posted July 19, 2022 Share Posted July 19, 2022 Is this going to be the same unit for every product, or are some different? Link to comment Share on other sites More sharing options...
Mark C Posted July 19, 2022 Author Share Posted July 19, 2022 Is it possible to be a variable? One product is in pieces while others are in Liters Link to comment Share on other sites More sharing options...
lordignus Posted July 19, 2022 Share Posted July 19, 2022 7 minutes ago, Mark C said: Is it possible to be a variable? One product is in pieces while others are in Liters If it's variable there's no quick-and-easy way as far as I know, you'd need a custom module or at least some overrides/template modifications, or I guess you could do it some hacky way with JS and a hidden element in the product description or something containing the correct unit for the product. Just thinking out loud 😄 Link to comment Share on other sites More sharing options...
Ali Samie Posted July 19, 2022 Share Posted July 19, 2022 This is interesting topic. As the "Liters" or "Pieces" are unit entities and they are attached to product. So, we can use their data in front templates. But it should be tested. I recommend you at first step to dump all data about the product in front template file and look for the unit data. If it is there you can use it easily. Link to comment Share on other sites More sharing options...
Knowband Plugins Posted July 19, 2022 Share Posted July 19, 2022 You Need to Assign the stock data as per the product on the controllers/front/ProductController.php , and use the same on "/themes/{Your-theme}/templates/catalog/_partials/product-add-to-cart.tpl". On the Above tpl file, Add the HTMLcontent , even you can add js changes in the "themes/{Your-theme}/assets/js/theme.js". Link to comment Share on other sites More sharing options...
Mark C Posted July 22, 2022 Author Share Posted July 22, 2022 (edited) i am thinking if it's more easy to add column (textbox) beside the "minimum quantity for sale" Edited July 22, 2022 by Mark C (see edit history) Link to comment Share on other sites More sharing options...
Knowband Plugins Posted July 26, 2022 Share Posted July 26, 2022 If you want to creata a field for Litre in the Admin product page, so it wil be better if you use the hook "hookDisplayAdminProductsExtra" like, public function hookDisplayAdminProductsExtra($params) { //Your code return $this->display(__FILE__, 'views/templates/admin/tpl_name.tpl'); } ->You can save the data using the hook "hookActionProductSave" like, public function hookActionProductSave($params) { //Your code } As if you add the same next to the "Minimum quantity for sale", it will be very complex prcess. Link to comment Share on other sites More sharing options...
Mark C Posted July 27, 2022 Author Share Posted July 27, 2022 (edited) On 7/20/2022 at 2:20 AM, Knowband Plugins said: You Need to Assign the stock data as per the product on the controllers/front/ProductController.php , and use the same on "/themes/{Your-theme}/templates/catalog/_partials/product-add-to-cart.tpl". On the Above tpl file, Add the HTMLcontent , even you can add js changes in the "themes/{Your-theme}/assets/js/theme.js". from this idea, I think I can use the "unity" column. I will just edit the tpl file in "/themes/{Your-theme}/templates/catalog/_partials/product-add-to-cart.tpl". Is this code below correct? {l s='The minimum purchase order quantity for the product is %quantity% %unity%.' d='Shop.Theme.Checkout' sprintf=['%quantity%' => $product.minimal_quantity, '%unity%' => $product.unity] } Edited July 27, 2022 by Mark C (see edit history) Link to comment Share on other sites More sharing options...
Knowband Plugins Posted August 1, 2022 Share Posted August 1, 2022 On 7/27/2022 at 1:01 PM, Mark C said: from this idea, I think I can use the "unity" column. I will just edit the tpl file in "/themes/{Your-theme}/templates/catalog/_partials/product-add-to-cart.tpl". Is this code below correct? {l s='The minimum purchase order quantity for the product is %quantity% %unity%.' d='Shop.Theme.Checkout' sprintf=['%quantity%' => $product.minimal_quantity, '%unity%' => $product.unity] } Yes It is correct, it will result as : https://nimb.ws/LSUbEq Link to comment Share on other sites More sharing options...
Mark C Posted August 4, 2022 Author Share Posted August 4, 2022 On 8/2/2022 at 12:39 AM, Knowband Plugins said: Yes It is correct, it will result as : https://nimb.ws/LSUbEq it works. Thank you very much! Link to comment Share on other sites More sharing options...
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