How to setup Delivery date/Availability

Component productXport allows you to setup DELIVERY_DATE / AVAILABILITY exactly as you need to. How to do that?

Login to administration and go to
Components - productXport - Global setting - VirtueMart.

You see something like that:

There is the field named "PHP code to run during product preparing". You can modify this code to your needs. This code is executed for each product. That means you can modify the output data. Product is available in the variable $product, which is object. Most usable part-variables are:

$product->availability and possibly $product->stock predefined values are the same what is stored in the database.

Let us show copy&paste examples:

Example first:

You need to export number of days to product shipping depending on the stock. If stock > 0 availability is 0, if stock is <=0 availability is 5.

if ($product->stock > 0) {
	$product->availability = "0";
} else {
	$product->availability = "5";

Example second:

availability is stored in the database as one of those values: 24h.gif, 48h.gif, 7d.gif, 14d.gif and you need to export availability according to those values:

switch ($product->availability) {
	case '24h.gif':
		$product->availability = "1";
	case '48h.gif':
		$product->availability = "2";
	case '48h.gif':
		$product->availability = "2";
	case '7d.gif':
		$product->availability = "7";
	case '14.gif':
		$product->availability = "14";

If you have another interesting usage of "PHP code to run during product preparing", please, send it to us, we can offer this code to other users on this page.



Cart empty