Ejemplo n.º 1
0
   [40]=>
   string(9) "Tax class"
   [41]=>
   string(3) "URL"
   [42]=>
   string(6) "Viewed"
   [43]=>
   string(6) "Weight"
 }
 */
 $cats_from_name = explode(':', $post[1]);
 p($cats_from_name);
 $cat_from_name = $cats_from_name[0];
 $item_save = array();
 $item_save['content_title'] = $post[26];
 $item_save['content_url'] = url_string($post[26]);
 $item_save['custom_field_original_id_from_old_website'] = $post[30];
 $item_save['custom_field_original_category_from_old_website'] = $post[1];
 $item_save['custom_field_model'] = $post[25];
 $item_save['content_body'] = $post[4];
 $item_save['content_parent'] = 2598;
 //p($post [1]);
 //p($post [15]);
 $is_cat = get_category($cat_from_name);
 $get_categories_params = array();
 $get_categories_params['taxonomy_value'] = $cat_from_name;
 p($get_categories_params);
 $get_categories_params = get_categories($get_categories_params);
 p($get_categories_params);
 if (!empty($is_cat)) {
     //	p ( $is_cat );
Ejemplo n.º 2
0
 /**
  * New Product
  *
  * Adds a new product
  *
  * @param string $name Product name
  * @param string $description Product description
  * @param array $collections Array of collection ID's (default: array())
  * @param float $price Product price (e.g., "5.00") (default: 1)
  * @param int $weight Product weight in default units (default: 0)
  * @param boolean $requires_shipping Does it require a shipping address? (default: FALSE)
  * @param boolean $track_inventory Shall we track inventory? (default: FALSE)
  * @param float $starting_inventory How many are in stock right now? (default: 0)
  * @param boolean $allow_oversell Should we allow the product to sell at zero stock? (default: FALSE)
  * @param string $sku The SKU identifier (default: '')
  * @param boolean $is_taxable Is this product subject to taxes? (default: FALSE)
  * @param array $member_tiers A "[group]" => "[price]" array of member tiered pricing (default: array())
  * @param boolean $is_download Is this a downloadable product? (default: FALSE)
  * @param string $download_name Filename for the download in /writeable/product_files/ (default: '')
  * @param int $download_size Total size of the file, in KB (default: 0)
  * @param int $promotion Shall we put purchasers into a usergroup? (default: '')
  * @param array $custom_fields Any custom field data (default: array())
  * @param array $product_options Array of product_options ID's (default: array())
  *
  * @return int $product_id The new product ID
  */
 function new_product($name, $description, $collections = array(), $price = 1, $weight = 0, $requires_shipping = FALSE, $track_inventory = FALSE, $starting_inventory = 0, $allow_oversell = FALSE, $sku = '', $is_taxable = FALSE, $member_tiers = array(), $is_download = FALSE, $download_name = '', $download_size = 0, $promotion = '', $custom_fields = array(), $product_options = array())
 {
     // generate $url_path
     $this->load->helper('admincp/url_string_helper');
     $insert_fields = array('product_url_path' => url_string($name, 'products', 'product_url_path'), 'product_collections' => empty($collections) ? FALSE : serialize($collections), 'product_name' => $name, 'product_price' => $price, 'product_description' => $description, 'product_weight' => $weight, 'product_track_inventory' => $track_inventory == FALSE ? '0' : '1', 'product_inventory' => $track_inventory == FALSE ? '0' : $starting_inventory, 'product_inventory_allow_oversell' => ($track_inventory == FALSE or $allow_oversell == FALSE) ? '0' : '1', 'product_sku' => $sku, 'product_taxable' => $is_taxable == FALSE ? '0' : '1', 'product_requires_shipping' => $requires_shipping == FALSE ? '0' : '1', 'product_member_tiers' => serialize($member_tiers), 'product_download' => $is_download == FALSE ? '0' : '1', 'product_download_name' => $is_download == FALSE ? '' : $download_name, 'product_download_size' => $is_download == FALSE ? '0' : $download_size, 'product_promotion' => $promotion, 'product_options' => (empty($product_options) or !is_array($product_options)) ? '' : serialize($product_options), 'product_deleted' => '0');
     if (is_array($custom_fields)) {
         foreach ($custom_fields as $name => $value) {
             $insert_fields[$name] = $value;
         }
     }
     $this->db->insert('products', $insert_fields);
     $product_id = $this->db->insert_id();
     // insert collection maps
     foreach ((array) $collections as $collection) {
         if ($collection != '0') {
             $this->db->insert('collection_maps', array('collection_id' => $collection, 'product_id' => $product_id));
         }
     }
     // clear cache
     if (isset($this->CI->cache)) {
         $this->CI->cache->file->clean();
     }
     return $product_id;
 }