Page 1 of 1

[Solved] Price based on the weight

Posted: Tue Aug 02, 2016 12:04 am
by analucatti
Hello, I wonder if there is a way to calculate the price based on the weight of each product, because I'm creating a jewelry store and need to calculate the price from the stones's weight. If so, could you give an example of how to do that?
Thanks.

Re: Price based on the weight

Posted: Tue Aug 02, 2016 12:40 am
by straightlight
analucatti wrote:Hello, I wonder if there is a way to calculate the price based on the weight of each product, because I'm creating a jewelry store and need to calculate the price from the stones's weight. If so, could you give an example of how to do that?
Thanks.
Welcome to the Opencart forum. Which OC version are you using?

Re: Price based on the weight

Posted: Tue Aug 02, 2016 8:30 pm
by analucatti
straightlight wrote:
analucatti wrote:Hello, I wonder if there is a way to calculate the price based on the weight of each product, because I'm creating a jewelry store and need to calculate the price from the stones's weight. If so, could you give an example of how to do that?
Thanks.
Welcome to the Opencart forum. Which OC version are you using?

i am using OC 2.1.0.2 version.

Re: Price based on the weight

Posted: Tue Aug 02, 2016 8:37 pm
by straightlight
The weight shipping module already calculates the weight by each products. In your admin - > extensions - > shipping - > weight module, this can be found and used. :)

More information can be found on the docs page regarding shipping modules: http://docs.opencart.com/extension/shipping/

Re: Price based on the weight

Posted: Mon Aug 08, 2016 2:01 pm
by kombi
Does anyone know where to edit Weight Based Shipping file that comes with OC so the weight does not show during check out just the cost?

Re: Price based on the weight

Posted: Mon Aug 08, 2016 5:14 pm
by straightlight
Yes, depending on the OC version you're using, this would either be in your catalog/model/total/weight.php file or into your catalog/model/extension/total/weight.php file if using the latest version of Opencart.

Re: Price based on the weight

Posted: Tue Aug 09, 2016 12:53 am
by kombi
Thanks for the information. We are using OC2.3.02. I can not find the code area to remove/edit to just remove the weight from the check out
chechout-weight.png

chechout-weight.png (8.93 KiB) Viewed 5056 times


Re: Price based on the weight

Posted: Tue Aug 09, 2016 3:27 am
by straightlight
Which shipping module are you using? Is it from the the core?

Re: Price based on the weight

Posted: Tue Aug 09, 2016 3:49 am
by kombi
Thank you for the reply. It is the core "weight base shipping"
core-ship.png

core-ship.png (2.48 KiB) Viewed 5046 times

core-ship1.png

core-ship1.png (7.1 KiB) Viewed 5046 times


Re: Price based on the weight

Posted: Tue Aug 09, 2016 3:57 am
by straightlight
Since there are some parentheses that may be useful for other modules when fetching the text information, I would suggest to do the changes as the following from your catalog/model/extension/shipping/weight.php file.

Find:

Code: Select all

'title'        => $result['name'] . '  (' . $this->language->get('text_weight') . ' ' . $this->weight->format($weight, $this->config->get('config_weight_class_id')) . ')',
replace with:

Code: Select all

'title'        => $result['name'] . '  ()',
See if that fixes the issue.

Re: Price based on the weight

Posted: Tue Aug 09, 2016 4:22 am
by kombi
Thank you, that worked perfect..
core-ship-fix.png

core-ship-fix.png (4.6 KiB) Viewed 5040 times


Re: Price based on the weight

Posted: Tue Aug 09, 2016 4:31 am
by straightlight
No problem, enjoy.