- Posts: 29
- Thank you received: 0
Sell products even if they are out of stock
11 years 10 months ago #181710
by Stroppen
Sell products even if they are out of stock was created by Stroppen
Hello
Is there any way to keep sell products even if they are out of stock.
For exampel: if we have a product in stock, but a customer wants to order 2, then hikashop should not refuse the customer's order. But we still wants to show the customer just how many products we have in stock so they know.
Is this possible?
Thanks in advance...
Best regards,
Henrik
Is there any way to keep sell products even if they are out of stock.
For exampel: if we have a product in stock, but a customer wants to order 2, then hikashop should not refuse the customer's order. But we still wants to show the customer just how many products we have in stock so they know.
Is this possible?
Thanks in advance...
Best regards,
Henrik
Please Log in or Create an account to join the conversation.
11 years 10 months ago #181748
by nicolas
Replied by nicolas on topic Sell products even if they are out of stock
Hi,
In that case, the best is to artificially increase the stock of the products (so for example, when you have 5 products in stock, you enter 1005 in the quantity field of the product) and then you edit the file "quantity" of the view "product" via the menu Display>Views and change the line:
$text = JText::sprintf('X_ITEMS_IN_STOCK',$this->row->product_quantity);
to:
$text = JText::sprintf('X_ITEMS_IN_STOCK',max($this->row->product_quantity-1000,0));
That way customers can still purchase out of stock goods and they still see the correct stock.
In that case, the best is to artificially increase the stock of the products (so for example, when you have 5 products in stock, you enter 1005 in the quantity field of the product) and then you edit the file "quantity" of the view "product" via the menu Display>Views and change the line:
$text = JText::sprintf('X_ITEMS_IN_STOCK',$this->row->product_quantity);
to:
$text = JText::sprintf('X_ITEMS_IN_STOCK',max($this->row->product_quantity-1000,0));
That way customers can still purchase out of stock goods and they still see the correct stock.
Please Log in or Create an account to join the conversation.
11 years 10 months ago #181757
by Stroppen
Replied by Stroppen on topic Sell products even if they are out of stock
Hi Nicolas,
Thanks for your answer.
That code dont seem to change anything on the site. If i set the quantity to 1014 on a product the site shows available products 1014.
But if i instead changes this line
to
the page displays the correct quantity of some of the products, but not all.
Any ideas?
Regards,
Henrik
Thanks for your answer.
That code dont seem to change anything on the site. If i set the quantity to 1014 on a product the site shows available products 1014.
Code:
<div class="hikashop_product_stock">
<?php
if($this->row->product_quantity==1){
if(JText::_('X_ITEM_IN_STOCK')=='X_ITEM_IN_STOCK'){
$text = JText::sprintf('X_ITEMS_IN_STOCK',max($this->row->product_quantity-1000,0));
}else{
$text = JText::sprintf('X_ITEM_IN_STOCK',$this->row->product_quantity);
}
}else{
$text = JText::sprintf('X_ITEM_IN_STOCK',$this->row->product_quantity);
}
But if i instead changes this line
Code:
$text = JText::sprintf('X_ITEM_IN_STOCK',$this->row->product_quantity);
Code:
$text = JText::sprintf('X_ITEM_IN_STOCK',max($this->row->product_quantity-1000,0));
Any ideas?
Regards,
Henrik
Please Log in or Create an account to join the conversation.
11 years 10 months ago #181766
by nicolas
Replied by nicolas on topic Sell products even if they are out of stock
Hi,
Well, you need to change the three lines with JText::sprintf( on that code in order to do it for all the cases.
I just gave you a simplified instruction thinking it would be enough.
Well, you need to change the three lines with JText::sprintf( on that code in order to do it for all the cases.
I just gave you a simplified instruction thinking it would be enough.
Please Log in or Create an account to join the conversation.
Time to create page: 0.186 seconds