Ejemplo n.º 1
0
	/**
	 * Saves product property indexes to the index table
	 *	 
	 * @since 1.1
	 *
	 * @return void
	 **/
	function index () {
		foreach ($this->properties as $property) {
			switch ($property) {
				case "prices":
					$prices = array();
					foreach ($this->Product->prices as $price) {
						if ($price->type == "N/A") continue; // Skip disabled pricelines
						$prices[] = "$price->label $price->sku";
					}
					$content = join(' ',$prices);
					break;
				case "specs":
					$specs = array();
					foreach ($this->Product->specs as $Spec)
						$specs[] = "$Spec->name $Spec->value";
					$content = join(' ',$specs);
					break;
				case "categories":
					$categories = array();
					foreach ($this->Product->categories as $Category)
						$categories[] = $Category->name;
					$content = join(' ',$categories);
					break;
				case "tags":
					$tags = array();
					foreach ($this->Product->tags as $Tag)
						$tags[] = $Tag->name;
					$content = join(' ',$tags);
					break;
				default: $content = $this->Product->{$property}; break;
			}
			$Indexer = new ContentIndex($this->Product->id,$property);
			$Indexer->save($content);
		}
	}
Ejemplo n.º 2
0
 /**
  * Saves product property indexes to the index table
  *
  * @author Jonathan Davis
  * @since 1.1
  *
  * @return void
  **/
 function index()
 {
     $properties = apply_filters('shopp_index_product_properties', $this->properties);
     foreach ($properties as $property) {
         switch ($property) {
             case "prices":
                 $prices = array();
                 foreach ($this->Product->prices as $price) {
                     if ($price->type == "N/A") {
                         continue;
                     }
                     // Skip disabled pricelines
                     $prices[] = "{$price->label} {$price->sku}";
                 }
                 $content = join(' ', $prices);
                 break;
             case "specs":
                 $specs = array();
                 foreach ($this->Product->specs as $Spec) {
                     $specs[] = "{$Spec->name} {$Spec->value}";
                 }
                 $content = join(' ', $specs);
                 break;
             case "categories":
                 $categories = array();
                 foreach ($this->Product->categories as $Category) {
                     $categories[] = $Category->name;
                 }
                 $content = join(' ', $categories);
                 break;
             case "tags":
                 $tags = array();
                 foreach ($this->Product->tags as $Tag) {
                     $tags[] = $Tag->name;
                 }
                 $content = join(' ', $tags);
                 break;
             default:
                 $content = $this->Product->{$property};
                 break;
         }
         $Indexer = new ContentIndex($this->Product->id, $property);
         $Indexer->save($content);
     }
 }