PHP Classes
elePHPant
Icontem

File: req/set_POST_products_variable.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Vaclav Mares  >  ontoProdukt  >  req/set_POST_products_variable.php  >  Download  
File: req/set_POST_products_variable.php
Role: Application script
Content type: text/plain
Description: set_POST_products_variable.php
Class: ontoProdukt
Generate product feeds in XML formats
Author: By
Last change:
Date: 4 years ago
Size: 3,626 bytes
 

Contents

Class file image Download
<?
if ($_POST['submit'])
{
$product_count = $_POST['value'];

    for (
$p = 0; $p < $product_count; ++$p)
    {
     
$a=$p+1;
     
$category[$p] = $_POST['category'.$a];
     
$category[$p]= preg_replace("/&/", "And", $category[$p]); //Protege mi neumožní vytvořit třídu obsahující v názvu & či mezeru => musí dojít k překódování znaků.(kompatibilita s jinými formáty)
     
$category[$p]= preg_replace("/ /", "_", $category[$p]); //kategorie jsou číslovány od 1....=> proto +1
     
$subcategory[$p] = $_POST['subcategory'.$a];
     
$subcategory[$p]= preg_replace("/&/", "And", $subcategory[$p]);
     
$subcategory[$p]= preg_replace("/ /", "_", $subcategory[$p]); //kategorie jsou číslovány od 1....=> proto $p tzn +1
     
$name[$p] = $_POST['name'.$a];
     
$productname[$p] = $_POST['productname'.$a];
     
$productnameext[$p] = $_POST['productnameext'.$a];
     
$price[$p] = $_POST['price'.$a];
     
$manufacturer[$p] = $_POST['manufacturer'.$a]; // manufacturer = brand (google base)
     
$productDescription[$p] = $_POST['productDescription'.$a];
     
$quality[$p] = $_POST['quality'.$a]; //quality= item_type(zbozi.cz) = condition(google base)
     
$product_url[$p] = $_POST['product_url'.$a];
     
$image_url[$p] = $_POST['image_url'.$a];
     
$code[$p] = $_POST['code'.$a]; //code = productno(zbozi.cz)
     
$quantity[$p] = $_POST['quantity'.$a];
 
     
$vat[$p] = $_POST['vat'.$a];
     
$tax_rate[$p] = $_POST['tax_rate'.$a]; //tax_rate = price_vat(zbozi.cz)
     
$dues[$p] = $_POST['dues'.$a];
     
$delivery_date[$p] = $_POST['delivery_date'.$a];
     
$shop_depots[$p] = $_POST['shop_depots'.$a];
     
$tollfree[$p] = $_POST['tollfree'.$a];
     
$firmy_cz[$p] = $_POST['firmy_cz'.$a];
     
$ean[$p] = $_POST['ean'.$a];
     
$variant[$p] = $_POST['variant'.$a];
     
$tollfree[$p] = $_POST['tollfree'.$a];
     
      if (
$generatedFormat == 'XML')
      {
     
$vat[$p] = $_POST['vat'.$a];
     
$price_vat[$p] = $_POST['price_vat'.$a];
     
$tax_rate[$p] = $_POST['tax_rate'.$a]; //tax_rate = price_vat(zbozi.cz)
     
$dues[$p] = $_POST['dues'.$a];
     
$delivery_date[$p] = $_POST['delivery_date'.$a];
     
$shop_depots[$p] = $_POST['shop_depots'.$a];
     
$tollfree[$p] = $_POST['tollfree'.$a];
     
$firmy_cz[$p] = $_POST['firmy_cz'.$a];
     
$ean[$p] = $_POST['ean'.$a];
     
$ean[$p] = $_POST['mpn'.$a];
     
$variant[$p] = $_POST['variant'.$a];
     
$tollfree[$p] = $_POST['tollfree'.$a];
      }
     
      if (
$generatedFormat == 'Heureka_XML')
      {
     
$vat[$p] = $_POST['vat'.$a];
     
$price_vat[$p] = $_POST['price_vat'.$a];
     
$tax_rate[$p] = $_POST['tax_rate'.$a]; //tax_rate = price_vat(zbozi.cz)
     
$dues[$p] = $_POST['dues'.$a];
     
$delivery_date[$p] = $_POST['delivery_date'.$a];
     
$ean[$p] = $_POST['ean'.$a];
     
$variant[$p] = $_POST['variant'.$a];
     
$val[$p] = $_POST['val'.$a];
     
$isbn[$p] = $_POST['isbn'.$a];
      }
     
     
$variant[$p] = $_POST['variant'.$a];
     
//google base
     
if ( $generatedFormat == 'RSS2')
      {
     
$upc[$p] = $_POST['upc'.$a];
     
$mpn[$p] = $_POST['isbn'.$a];
      }
    }
   
   
//týká se old_feed
   
$product_type = preg_split("/(>)/", $product_type); //jako oddělovač je použito ">" využití PHP Perl-compatible funkcí => vztvoření pole hodnot
   
for ($p = 0; $p < count($product_type); ++$p){
     
$product_type[$p]= trim($product_type[$p]); //odstranění prázných znaků
   
}
     
 
}

  
    
?>