News:

Support the VirtueMart project and become a member

Main Menu

Product Automatic Expiration

Started by saviB, February 13, 2013, 18:19:30 PM

Previous topic - Next topic

saviB

Hi Folks. Is there a way to make VM products expire? Not an auction, not a coupon, the products themselves. I know there is an availability date - but not expiration. Why would I want this? I have a client that sells workshops (speaking engagements). Because VM is so easy to use, we are setting up each engagement as a product. In other words, a product may be EVENT NAME + February 4. Of course, after Feb 4 passes - the product should terminate automatically.

It seems like a pretty straight forward and useable addition to the VM product editor.

jenkinhill

Not seen anybody else request this, but maybe you could ask for devopment quotes on http://forum.virtuemart.net/index.php?board=18.0 or http://jobs.virtuemart.net/

You can remove price & add to cart button from a product using the price expiry date on the Product pricing panel of the product information page on VM2.0.18a. That prevents anyone "buying" it after that date.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

PolishedGeek

As Jenkinhill says, this could certainly be achieved with a customization. I have an idea of how it could be done without any hacks to VM2, which is always an important consideration. If you decide to hire a professional developer to handle this for you, keep us in mind. We do a lot of custom VM extensions, integration and custom development. If you post on the commercial boards that Jenkinhill suggests, please do post the link here so we can take the conversation to the other board. Thanks!   
~ Deb Cinkus, CEO
Polished Geek, LLC   |    www.PolishedGeek.com

Creators of JoomLister - eBay Lister for Joomla!

djold

You can remove price & add to cart button from a product using the price expiry date on the Product pricing panel of the product information page on VM2.0.18a. That prevents anyone "buying" it after that date.
[/quote]

Hi Kelvyn!

The 'Add to cart' button does not dissapear, only the price. So the customer could by the product at price 0 $ for instance.
I wondering that it could be hacking to make a sublayout. (I need this possibility only on product_horizon layout.)
Can You tell me how can I reference to the product price expire date in array $viewData['???'] ?

Best Regards,
Gyula

GJC Web Design

add a snippet of code in the template to test if the exp date is passed.. if so hide the add to cart
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

jenkinhill

The template system in VM3 is different from that in VM2. The clue is that this thread is 3.5 years old!
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

djold

I using the latest version of VM 3.0.18. Is there a solutuion already? Maybe a plugin or something?

GJC Web Design

I know of no plugin..
but this is the solution

add a snippet of code in the template to test if the exp date is passed.. if so hide the add to cart
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

djold

Thank You the good idea. I made a script, but not inside the template.
With mysqli queries I cheking virtuemart_product_prices table and within product_price_publish_down field. If it is older than actual date, product became unpublished.
Finally with crontab I can execute it every day. (I need unpublish daily foods after p.m. 3h.)

GJC Web Design

GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

djold

#10
If somebody faceing the same problem, here is my code:
(You should insert the proper username, password and dbname of course.)


<?php
$servername 
"localhost";
$username "???";
$password "???";
$dbname "???";

// Create connection
$conn mysqli_connect($servername$username$password$dbname);
// Check connection
if (!$conn) {
    die(
"Connection failed: " mysqli_connect_error());
}

$sql "SELECT virtuemart_product_id, product_price_publish_down FROM cm42j_virtuemart_product_prices";
$result mysqli_query($conn$sql);
$current_date date("Y-m-d h:i:s");

while(
$row mysqli_fetch_assoc($result)) {
if ($row["product_price_publish_down"] <= $current_date) {
  $id $row["virtuemart_product_id"];
  
  $sql_2 "UPDATE cm42j_virtuemart_products SET published = '0' WHERE virtuemart_product_id = $id";
  $result_2 mysqli_query($conn$sql_2);
}
}

mysqli_close($conn);
?>