- Posts: 21
- Thank you received: 0
Set default product weight?
- FranksBank
-
Topic Author
- Offline
Less
More
14 years 5 months ago #47061
by FranksBank
Set default product weight? was created by FranksBank
Quick question:
Is it possible to set a default weight for all (new) products?
I'm trying to streamline the process of entering new products for the user. All products weigh the same so I'd like that weight to be already specified when creating a new product, rather than the user having to set it every time (if they forget, the shipping doesn't work at checkout).
It's not an important requirement; just a 'nice to have' if possible.
So, possible?
Cheers,
Frank
Is it possible to set a default weight for all (new) products?
I'm trying to streamline the process of entering new products for the user. All products weigh the same so I'd like that weight to be already specified when creating a new product, rather than the user having to set it every time (if they forget, the shipping doesn't work at checkout).
It's not an important requirement; just a 'nice to have' if possible.
So, possible?
Cheers,
Frank
Please Log in or Create an account to join the conversation.
14 years 5 months ago - 14 years 5 months ago #47146
by Xavier
Replied by Xavier on topic Re: Set default product weight?
Hi FranksBank,
You can set a default value by editing the code.
Edit the file: YourSite/Administrator/component/com_hikashop/views/product/tmpl/common.php
And change the value of the product weight (l.48) from:
To
Edit the value of "3.000" to what you want.
You can set a default value by editing the code.
Edit the file: YourSite/Administrator/component/com_hikashop/views/product/tmpl/common.php
And change the value of the product weight (l.48) from:
Code:
value="<?php echo @$this->element->product_weight;?>"
Code:
value="<?php if(@$this->element->product_weight != "0.000"){echo @$this->element->product_weight;}else{echo "3.000";} ?>"
Last edit: 14 years 5 months ago by Xavier.
Please Log in or Create an account to join the conversation.
- FranksBank
-
Topic Author
- Offline
Less
More
- Posts: 21
- Thank you received: 0
14 years 5 months ago #47156
by FranksBank
Replied by FranksBank on topic Re: Set default product weight?
Thanks Xavier. I made the change but now when I try to add a new product, the weight field is empty. What's even more odd, is that having reversed the change and put the original code/file back in place, it's still blank. Yoiks! Any ideas?
Please Log in or Create an account to join the conversation.
14 years 5 months ago #47161
by Xavier
Replied by Xavier on topic Re: Set default product weight?
By default the weight field is empty.
Try to change the value to:
Try to change the value to:
Code:
value="<?php if($this->element->product_weight != null){echo @$this->element->product_weight;}else{echo "3.000";} ?>"
The following user(s) said Thank You: FranksBank
Please Log in or Create an account to join the conversation.
- FranksBank
-
Topic Author
- Offline
Less
More
- Posts: 21
- Thank you received: 0
14 years 5 months ago #47162
by FranksBank
Replied by FranksBank on topic Re: Set default product weight?
Ahhh! Ok. My stupid fault/oversight. I've just had to go through an exercise of adding weights to 500 products, and got used to seeing "0.000" in the fields when I went in to amend. I forgot the field was blank for a new one. Sorry for that panic!
That new 'null' line works a treat. Thank you!
Do you happen to know if this can be done as an override (so I don't lose the setting of an upgrade comes in)? If so, what should the folder structure be within my template/html/?
That new 'null' line works a treat. Thank you!
Do you happen to know if this can be done as an override (so I don't lose the setting of an upgrade comes in)? If so, what should the folder structure be within my template/html/?
Please Log in or Create an account to join the conversation.
14 years 5 months ago #47178
by nicolas
Replied by nicolas on topic Re: Set default product weight?
You can edit the file "common" of the view "product" of your BACK END template via the menu Display->Views for that.
Please Log in or Create an account to join the conversation.
- FranksBank
-
Topic Author
- Offline
Less
More
- Posts: 21
- Thank you received: 0
14 years 5 months ago #47187
by FranksBank
Replied by FranksBank on topic Re: Set default product weight?
Of course, yes. I should have had a look for it there.
Problem though. Adding the adjusted line there doesn't work. The code hint (see image below) suggests an issue with the double quotes (tried the _QQ_ workaround but doesn't fix it). Interestingly, the exact same code works if I remove the override and go back to adjusting/uploading the original file. If I then look at the replaced code through Display->Views (what it now thinks is its original) the same code hint is there but the value shows correctly for a new product. Something to do with any override being ignored owing to the code hint issue perhaps?
I've left the 'amended original' in place for now as it works well. Would be great if the override worked; but not a major problem in the scheme of things.
Problem though. Adding the adjusted line there doesn't work. The code hint (see image below) suggests an issue with the double quotes (tried the _QQ_ workaround but doesn't fix it). Interestingly, the exact same code works if I remove the override and go back to adjusting/uploading the original file. If I then look at the replaced code through Display->Views (what it now thinks is its original) the same code hint is there but the value shows correctly for a new product. Something to do with any override being ignored owing to the code hint issue perhaps?
I've left the 'amended original' in place for now as it works well. Would be great if the override worked; but not a major problem in the scheme of things.
Please Log in or Create an account to join the conversation.
14 years 5 months ago #47372
by nicolas
Replied by nicolas on topic Re: Set default product weight?
You should add that code BEFORE the <input tag.
Please Log in or Create an account to join the conversation.
Time to create page: 0.237 seconds