Beispiel #1
0
    private function relistItems()
    {
        if (Configuration::get('EBAY_LISTING_DURATION') != 'GTC' and Configuration::get('EBAY_AUTOMATICALLY_RELIST') == 'on') {
            $days = substr(Configuration::get('EBAY_LISTING_DURATION'), 5);
            //We do relist automatically each day
            $this->setConfiguration('EBAY_LAST_RELIST', date('Y-m-d'));
            $ebay = new eBayRequest();
            $items = Db::getInstance()->ExecuteS('
					SELECT ep.id_product_ref AS itemID, ep.id_product
						FROM ' . _DB_PREFIX_ . 'ebay_product AS ep
						WHERE NOW()  > DATE_ADD(ep.date_upd, INTERVAL ' . $days . ' DAY)
						LIMIT 0,10
					');
            foreach ($items as $item) {
                $newItemID = $ebay->relistFixedPriceItem($item);
                $newItemID = $newItemID != 0 ? $newItemID : $item['itemID'];
                //Update of the product so that we don't take it in the next 10 products to relist !
                Db::getInstance()->autoExecute(_DB_PREFIX_ . 'ebay_product', array('id_product_ref' => pSQL($newItemID), 'date_upd' => date('Y-m-d h:i:s')), 'UPDATE', '`id_product_ref` = ' . $item['itemID']);
            }
        }
    }