Set quantity default value to 0

  • Posts: 71
  • Thank you received: 3
9 years 5 months ago #203151

-- HikaShop version -- : 2.4.0

Hello,

I try to set the default quantity value to 0.
I found this thread :
www.hikashop.com/forum/content-creation/...product-display.html

I changed the default value in the database, but the value which appears in the product add form (front-end and back-end) is still unlimited.

Should I also modify a view or something ?

Thank you

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 5 months ago #203161

Hi,

Can you please provide more details about what you want to achieve (and where ; because I see that you have HikaMarket) ?
The modification of the "product quantity" in the database is one thing but it won't change the default quantity value for new products... And depending what you want to do, the process will be slightly different.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 71
  • Thank you received: 3
9 years 5 months ago #203205

Hello Jerome,

Yes you're right, maybe you will have a better option for my problem ;)

We are putting in place a second-hand selling system through Hikamarket.

I would like to propose to vendors two possibilities :
1. They sell through the marketplace, customer can buy their product through Hikamarket payment and delivery system (like priceminister)
2. They only publish classifieds, customer contact them directly to set the final price and produc pick-up or delivery (like le bon coin)

My idea was to use the quantity field to differentiate the two processes, at product creation.
1. Vendor defines a quantity > 0 (most of the time 1), the product is then purchasable, the button "add to cart" appears
2. Vendor lets the quantity to 0, the product is not purchasable, the button "add to cart" does not appear. A message "classifieds" appear (thanks to css) on products list next to these products.

In order to avoid too much errors, I wanted thus to put 0 quantity by default in the product add form in front-end.

The ideal solution would be I guess to propose a custom field "Type of sale" at product creation with the two values Classifieds / Secured sale and to make the product not purchasable (no add to card button) if Classified is selected, whatever the quantity is. But I don't konw how to do this.

Many thanks for your help.

Marina

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
9 years 5 months ago #203207

Hi,

What can potentially be done is to create a custom product field as a single dropdown with the to desired values.
Then set up a mass action with a trigger set on "onBeforeProductCreate", a filter based on the created custom field, and depending on the custom field value, set the quantity to "0".

Here is the documentation related on the custom fields:
www.hikashop.com/support/documentation/4...shop-field-form.html

And there about the mass actions:
www.hikashop.com/support/documentation/167-massaction-form.html

The following user(s) said Thank You: marremp2

Please Log in or Create an account to join the conversation.

  • Posts: 71
  • Thank you received: 3
9 years 5 months ago #203304

That's brilliant !

Thank you Xavier it works perfectly !!

Please Log in or Create an account to join the conversation.

Time to create page: 0.069 seconds
Powered by Kunena Forum