How do I sell a "non-stocked" product with shipping time mentioned on the page?

Started by rage76, June 22, 2019, 08:15:37 AM

Previous topic - Next topic

rage76

I would like to receive orders (with payment) for products not in stock. The shipping time / lead time should be mentioned on the product page and should also get embedded in the order/invoice.

Any suggestions / help shall be appreciated.

Joomla 3.9
VM 3.4.2

Jörgen

This is not impossible, I have done soemthing similar. I use overrides in my template (no core changes) and also some template overrides in the backend.
You have to check the available items and availability date and the decide what to display on the product details page.

the addtocartbar, addtocartbutton are the places to make the changes.
This could give some idea for addtocartbtn:

<?php
/**
 *
 * loads the add to cart button
 *
 * @package    VirtueMart
 * @subpackage
 * @author Max Milbers, Valerie Isaksen
 * @link http://www.virtuemart.net
 * @copyright Copyright (c) 2015 VirtueMart Team. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @version $Id: addtocartbtn.php 8024 2014-06-12 15:08:59Z Milbo $
 */
// Check to ensure this file is included in Joomla!
defined ('_JEXEC') or die('Restricted access');
$app JFactory::getApplication('site');
$document JFactory::getDocument();
$template $app->getTemplate(true);
// JH 2018-04-21
$product $viewData['product'];
$stockhandle VmConfig::get('stockhandle_products'false) && $product->product_stockhandle $product->product_stockhandle VmConfig::get('stockhandle','none');
$days VmConfig::get('latest_products_days');
$cdate strtotime ($product->created_on) ;
$thisdate strtotime ('now');
$availdate strtotime ($product->product_available_date);
$ndate $thisdate - ($days 86400);
$productisnew $cdate $ndate;
$productisordered $thisdate $availdate;

if ( 
VmConfig::get ('display_stock'1)) {
$stocklevel = ($product->product_in_stock $product->product_ordered);
}

vmdebug('addtocartbtn viewdata[orderable]'$viewData['orderable']);
vmdebug('addtocartbtn stocklevel'$stocklevel);

if(isset(
$viewData['orderable'])){
// JH 2018-04-21
if ($stocklevel 0) {
    vmdebug(' $stocklevel'$stocklevel);
echo '<input type="submit" name="addtocart" class="addtocart-button btn ' '" value="'.vmText::_'COM_VIRTUEMART_CART_ADD_TO' ).'" title="'.vmText::_'COM_VIRTUEMART_CART_ADD_TO' ).'" />';
} else if ($product->product_discontinued){
 
if ($isPhoto)
echo '<input disabled type="submit" name="addtocart" class="addtocart-button btn ' '" value="'.vmText::_'COM_VIRTUEMART_CART_DISCONTINUED' ).'" title="'.vmText::_'COM_VIRTUEMART_CART_DISCONTINUED_DESC' ).'" />';
else
            echo 
'<input disabled type="submit" name="addtocart" class="addtocart-button btn ' '" value="'.vmText::_'TPL_VM_SOLD' ).'" title="'.vmText::_'TPL_VM_SOLD_DESC' ).'" />';
} else if ($productisnew OR $productisordered)  {
echo '<input type="submit" name="addtocart" class="addtocart-button btn ' .  '" value="'.vmText::_'COM_VIRTUEMART_CART_ADD_TO_CART_ANYWAY' ).'" title="'.vmText::_'COM_VIRTUEMART_CART_ADD_TO_CART_ANYWAY_DESC' ).'" />';

//echo '<button type="button" name="addtocart" class="addtocart-button-disabled btn btn-block hide' . ' " title="'.vmText::_( 'COM_VIRTUEMART_ADDTOCART_CHOOSE_VARIANT' ).'" >'.vmText::_( 'COM_VIRTUEMART_ADDTOCART_CHOOSE_VARIANT' ).'</button>';
}
}



This will give You an idea to start with :)
I deleted some code to only show what could be needed, there are maybe other more elegant solutions.

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

rage76

Many thanks for the quick reply my friend but I am not a developer so I donot have the expertise to code a solution. I would prefer a pre made plugin/module.

Best wishes

jjk

Quote from: rage76 on June 22, 2019, 08:15:37 AM
I would like to receive orders (with payment) for products not in stock.

You can choose the corresponding setting in the VM configuration > Shopfront settings tab.

Quote
The shipping time / lead time should be mentioned on the product page.
If the time is usually identical for a product, you could add a normal text (single language shop) or a translatable language key (multilingual shop) in the Product Edit > Status tab > Availability Box like in this description (copied from the manual):

Availability Box
Optional: You can use this box if you want to mention when your product will be available for pickup after placing an order. For example, you can mention "48 hours", "Now in Stock!", etc. The shopper will see this information along with the product details. If you operate a multilingual shop, you can also add your own language key here. For example COM_VM_48_HOURS and thereafter add this to your Joomla site language overrides in order to display "48 hours" in other languages.

Quoteand should also get embedded in the order/invoice.
I never tried that myself. Perhaps somebody else knows how to achieve that.
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

Studio 42

You can use a customfield plugin if you need advanced display.
If you pre-sell an item, you can set a date in product edit back-end and display the dynamic remaining time or the date after the product name.
So you can display for eg.
In the product  : Shipped  in 6 Days
In cart & order : Shipped Monday The 04 Jully 2019
And when the date is over, do not display the message.

rage76

Thank you for the replies.

@jjk - I have tried the VM configuration. That does serve the purpose, every product will have a different lead time.

@Studio 42 - I have studied a plugin by Webkul (pre order) but that doesn't quite work for me. I just want the customer to be able to place the order for the (non stocked) product with a lead time displayed. How do I do this with customfields? Please suggest a suitable plugin.

Edit: under VM Config, if I enable "Stock handling on product level", how do I disable other options below it?

I think, if I can do this, I may have a workable resolution.

Best regards !!

Studio 42

I dont know any existing plugin.
So you need to hire someone to write it.
It's not a big plugin so it should be done in 2 or 3 hours maximum.

kishoreonwork

This can be done with simple custom field .
From Custom Field - Create a custom field type string it give it a name like Preorder
Select cart attribute option to yes
And save the custom field.

Now edit any product and  go to custom field, Select Preorder and enter your date or anything you like and save the product.

Go to frontend and try to place order you will see your text in cart , order and invoices.

Not a big deal

Thanks
Kishore
I am available for paid joomla and virtuemart consulting.
http://www.kishoreweblabs.com/
skype kishore2607

Studio 42

@kishoreonwork, but not if you want display 2 text and hide it after date.

rage76

@kishoreonwork Thanks, I have already tried what you have suggested. I intend to use this option as a stop-gap solution till something better comes my way.

kishoreonwork

In my knowledge there is no plugin available for it ,
As @studio said it can be only done with custom coding which require very minimal effort appx(2-3Hr)
If you need paid solution you can also contact me or post a requirement in commercial forum .

Thanks
Kishore
I am available for paid joomla and virtuemart consulting.
http://www.kishoreweblabs.com/
skype kishore2607

rage76

Thanks Kishore

As of now I am using a customfield alongwith a pop-up (on page load) stating that the product is not stocked and has a lead time. So that the customer is well aware.

Should a need arise for a plugin, I shall definitely connect with you.