Example #1
0
 if (empty($country)) {
     $response['message'] = 'Please complete the required fields';
 }
 if (!empty($title)) {
     $search = esc_sql(like_escape($title));
     $search = strtolower($search);
     $query = "SELECT p.ID AS id, LOWER(p.post_title) AS title\n            FROM {$wpdb->posts} AS p\n            WHERE p.post_title = '{$search}'\n            AND p.post_type = 'banned-product'\n            AND p.post_status = 'publish'\n            ORDER BY p.post_title\n            LIMIT 1";
     $search_response = $wpdb->get_results($query, OBJECT);
     $search_response = $search_response[0];
     if (count($search_response) > 0) {
         //parent product exist, add only child proudcts now
         $parent = true;
         $parent_id = $search_response->id;
         //only save new products, so also check if child product already not existing
         if (!empty($alt_products)) {
             $products = get_new_products($parent_id, $alt_products);
             if (!empty($products)) {
                 //create new child posts
                 foreach ($products as $ctitle) {
                     create_child_post($ctitle, $country, $parent_id);
                 }
             }
         }
     } else {
         //parent don't exist, add parent and child products
         $alt_products = array_filter($alt_products);
         $pid = create_parent_post($title, $country);
         if (!empty($alt_products)) {
             foreach ($alt_products as $ctitle) {
                 create_child_post($ctitle, $country, $pid);
             }
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License v3 (2007)
 * as published by the Free Software Foundation.
 *
 * @package      TomatoCart
 * @author       TomatoCart Dev Team
 * @copyright    Copyright (c) 2009 - 2012, TomatoCart. All rights reserved.
 * @license      http://www.gnu.org/licenses/gpl.html
 * @link         http://tomatocart.com
 * @since        Version 1.1.8
 * @filesource
*/
global $osC_Template, $osC_Language, $osC_Image;
require_once 'templates/' . $osC_Template->getCode() . '/models/products.php';
$products = get_new_products();
?>

<?php 
if (sizeof($products)) {
    ?>
    <!-- module new_products start //-->
    <div class="moduleBox">
        <h6><?php 
    echo $osC_Box->getTitle();
    ?>
</h6>
        
        <ul class="products-list grid clearfix">
        <?php 
    foreach ($products as $product) {
Example #3
0
				$last = $obj->last;
			else 
			{
				dol_syslog("products.inc.php::get_new_products rien � faire", LOG_DEBUG);
				$last = 0;
			}
		}
		else
		{
			dol_syslog("products.inc.php::get_new_products erreur ".$sql, LOG_DEBUG);
			return -1;

		}
		
		// 1. recherche des nouveaux porduits		
		if ($res = get_new_products($siteid,$db, $user, $limit) < 0) print "Erreur traitement des produits �tape 1"."\n";
		else 	print "fin �tape 1 d�but �tape 2"."\n";
		// on fait les deux traitements syst�matiquement
		if ($res = get_products($siteid, $db, $user, $limit, $last)) print "traitement produit r�ussi $last $limit"." \n";
			else print "Erreur traitement des produits $last $limit"."\n";
		
		break;
	case 'prospect':
		print "traitement des prospects\n";
		
		// traitement de la limite
		if (! isset($argv[3])) $limit = 0;
		elseif ($argv[3] > 0 ) $limit = $argv[3];
		else $limit = 100; // on limite
		
		// pour ne pas re-traiter les prospects