예제 #1
0
파일: Dto.php 프로젝트: songtaiwu/m-cmsold
 public function getOrderByOrderTime($campaignId, $orderStatTime, $orderEndTime)
 {
     if (empty($campaignId) || empty($orderStatTime) || empty($orderEndTime)) {
         echo "campaignId ,orderStatTime or orderEndTime is null";
         exit;
     }
     $sql = "SELECT p.order_id,order_sn,add_time,order_status,pay_status,pay_name,order_time,cid,wi,order_status,pay_status,pay_name,shipping_fee,surplus,bonus,order_amount FROM `cps` as p LEFT OUTER JOIN ecs_order_info as i on i.order_id=p.order_id where p.cid=" . $campaignId . " and order_time>" . $orderStatTime . " and order_time<" . $orderEndTime;
     $dborder = $GLOBALS['db']->getAll($sql);
     if (empty($dborder)) {
         return NULL;
     }
     foreach ($dborder as $k => $v) {
         $order = new Order();
         $order->setOrderNo($v['order_sn']);
         $order_time = date('Y-m-d H:i:s', $v['order_time']);
         $order->setOrderTime($order_time);
         // 设置下单时间
         $order->setUpdateTime($order_time);
         // 设置订单更新时间,如果没有下单时间,要提前对接人提前说明
         $order->setCampaignId($v['cid']);
         // 测试时使用"101",正式上线之后活动id必须要从数据库里面取
         $order->setFeedback($v['wi']);
         $order->setFare($v['shipping_fee']);
         $order->setFavorable($v['bonus'] + $v['surplus']);
         //$orderStatus = new OrderStatus();
         //$orderStatus -> setOrderNo($order -> getOrderNo());
         $order->setOrderStatus($v['order_status']);
         // 设置订单状态
         $order->setPaymentStatus($v['pay_status']);
         // 设置支付状态
         $order->setPaymentType($v['pay_name']);
         // 支付方式
         $sql = "select * from ecs_order_goods where order_id=" . $v['order_id'] . " and goods_price>100";
         $order_goods = $GLOBALS['db']->getAll($sql);
         //echo "<pre>";print_r($order_goods);
         foreach ($order_goods as $k1 => $v1) {
             $pro = new Product();
             //$pro -> setOrderNo($order -> getOrderNo());
             $pro->setProductNo($v1['goods_sn']);
             $pro->setName($v1['goods_name']);
             $pro->setCategory("蛋糕");
             $pro->setCommissionType("");
             $pro->setAmount($v1['goods_number']);
             $a = number_format($v1['goods_price'] * (1 - ($v['bonus'] + $v['surplus']) / ($v['bonus'] + $v['surplus'] + $v['order_amount'])), 2, ".", "");
             $pro->setPrice($a);
             $products[] = $pro;
         }
         $order->setProducts($products);
         $orderlist[] = $order;
         $products = array();
     }
     //print_r($orderlist);
     //echo json_encode($orderlist);
     return $orderlist;
 }
예제 #2
0
파일: product_db.php 프로젝트: j-jm/web182
 public function getProduct($product_id)
 {
     $db = Database::getDB();
     $query = "SELECT * FROM products\n                  WHERE productID = '{$product_id}'";
     $result = $db->query($query);
     $row = $result->fetch();
     $category = CategoryDB::getCategory($row['categoryID']);
     $product = new Product();
     $product->setCategory($category);
     $product->setId($row['productID']);
     $product->setCode($row['productCode']);
     $product->setName($row['productName']);
     $product->setPrice($row['listPrice']);
     return $product;
 }
예제 #3
0
 function getProductBySku($sku)
 {
     global $database, $logger;
     $logger->debug(get_class($this) . "::getProductBySku({$sku})");
     $prod = new Product();
     $ps_prod = new ps_product();
     $ps_cat = new ps_product_category();
     $query = "select product_id from #__vm_product where product_sku=" . $sku;
     $database->loadQuery($query);
     $id = $db->loadResult();
     $prod->setOid($id);
     $prod->setName($ps_prod->get_field('product_name'));
     $prod->setFlypage($ps_prod->get_flypage($id));
     $prod->setCategoryId($ps_cat->get_cid($id));
     return $prod;
 }
 public function createAction()
 {
     $view = new ViewModel();
     $request = $this->getRequest();
     if ($request->isPost()) {
         $entityManager = $this->getEntityManager();
         $strProduct = $request->getPost()->product;
         $product = new \Product();
         $product->setName($strProduct);
         $entityManager->persist($product);
         $entityManager->flush();
         $view->setVariable('product', $product);
         $view->setTemplate('application/product/create_post');
     }
     return $view;
 }
 public function test_create_and_retrieve()
 {
     global $entityManager;
     $product = new Product();
     $product->setName('test product 1');
     $entityManager->persist($product);
     $entityManager->flush();
     $id = $product->getId();
     $this->assertFirstGreaterThanSecond($id, 0);
     /** @var Product $product */
     $product = $entityManager->find('Product', $id);
     $this->assertEqual($product->getId(), $id);
     $this->assertEqual($product->getName(), 'test product 1');
     $this->assertEqual(strlen($product->getCreated()), 19, 'created');
     $this->assertEqual(strlen($product->getUpdated()), 19, 'updated');
 }
예제 #6
0
 public static function generateProducts()
 {
     //read in xml document(products)
     $doc = simplexml_load_file(APPLICATION_PATH . '/../products.xml');
     foreach ($doc->category as $cat) {
         $categoryObj = new Category();
         $categoryObj->setUrlKey($cat->urlkey);
         $categoryObj->setName($cat->name);
         $categoryObj->save();
     }
     foreach ($doc->product as $product) {
         $productObj = new Product();
         $productObj->setName($product->name);
         $productObj->setPrice($product->price);
         $productObj->setSku($product->sku);
         $productObj->setDateCreated(date('d-m-Y H:i:s', time()));
         $productObj->setUrlKey($product->urlkey);
         $productObj->setProductImage($product->image);
         $productObj->setCategoryId($product->category);
         $productObj->save();
     }
 }
예제 #7
0
 public function create(SubCategory $sub_category, $name, $description, $price, $img, $stock)
 {
     $errors = array();
     $product = new Product($this->db);
     try {
         $product->setSubCategory($sub_category);
         $product->setName($name);
         $product->setDescription($description);
         $product->setPrice($price);
         $product->setImg($img);
         $product->setStock($stock);
     } catch (Exception $e) {
         $errors[] = $e->getMessage();
     }
     $errors = array_filter($errors, function ($val) {
         return $val !== true;
     });
     if (count($errors) == 0) {
         $idSubCategory = intval($product->getIdSubCategory());
         $name = $this->db->quote($product->getName());
         $description = $this->db->quote($product->getDescription());
         $price = $this->db->quote($product->getPrice());
         $img = $this->db->quote($product->getImg());
         $stock = $this->db->quote($product->getStock());
         $query = "INSERT INTO product(id_sub_category, name, description, price, img, stock) VALUES('" . $idSub_category . "', " . $name . ", " . $description . ", " . $price . ", " . $img . ", " . $stock . ")";
         $res = $this->db->exec($query);
         if ($res) {
             $id = $this->db->lastInsertId();
             if ($id) {
                 return $this->findById($id);
             } else {
                 return "Internal Server error";
             }
         }
     } else {
         return $errors;
     }
 }
예제 #8
0
파일: flow.php 프로젝트: songtaiwu/m-cmsold
 // 测试时使用"101",正式上线之后活动id必须要从cookie中获取
 $cps->setFare($order['shipping_fee']);
 $cps->setFavorable($order['bonus'] + $order['surplus']);
 // 设置优惠券
 $cps->setOrderStatus($order['order_status']);
 // 设置订单状态
 $cps->setPaymentStatus($order['pay_status']);
 // 设置支付状态
 $cps->setPaymentType($order['pay_name']);
 // 支付方式
 foreach ($cart_goods as $k => $v) {
     if ($v['goods_price'] > 0) {
         $pro = new Product();
         // $pro2 -> setOrderNo($order -> getOrderNo());
         $pro->setProductNo($v['goods_sn']);
         $pro->setName($v['goods_name']);
         $pro->setCategory("蛋糕");
         $pro->setCommissionType("");
         $pro->setAmount($v['goods_number']);
         $a = number_format($v['goods_price'] * (1 - ($order['bonus'] + $order['surplus']) / ($order['bonus'] + $order['surplus'] + $order['order_amount'])), 2, ".", "");
         $pro->setPrice($a);
         $products[] = $pro;
     }
 }
 $cps->setProducts($products);
 //var_dump(get_object_vars($cps));
 $sender = new Sender();
 $sender->setOrder($cps);
 $sender->sendOrder();
 $ordertime = $order['add_time'] + 8 * 3600;
 $sql = "INSERT INTO cps ( " . "order_id,src,channel,cid,wi,order_time)" . " values('{$new_order_id}','emar','cps'," . $arr[2] . ",'" . $arr[3] . "','" . $ordertime . "') ";
예제 #9
0
        } catch (Exception $e) {
            error('io-error', $e->getMessage());
        }
    });
});
/*
 * create new product
 */
$app->post('/products', function () use($app) {
    disable_cache($app);
    // only admins can create products
    if_is_admin(function () use($app) {
        try {
            $params = json_decode($app->request()->getBody(), true);
            $product = new Product();
            $product->setName($params['name']);
            $product->setCreatedAt(time());
            if (isset($params['data'])) {
                $product->setData(json_encode($params['data']));
            }
            $product->save();
            ok($product->toArray());
        } catch (Exception $e) {
            error('io-error', $e->getMessage());
        }
    });
});
/*
 * change product
 */
$app->put('/products/:id', function ($id) use($app) {
<?php

include __DIR__ . '/bootstrap.php';
include __DIR__ . '/../../bootstrap.php';
$debugbarRenderer->setBaseUrl('../../../src/DebugBar/Resources');
$debugStack = new Doctrine\DBAL\Logging\DebugStack();
$entityManager->getConnection()->getConfiguration()->setSQLLogger($debugStack);
$debugbar->addCollector(new DebugBar\Bridge\DoctrineCollector($debugStack));
$product = new Product();
$product->setName("foobar");
$entityManager->persist($product);
$entityManager->flush();
render_demo_page();
예제 #11
0
 /**
  * @expectedException InvalidArgumentException
  */
 public function testShouldThrowsAnExceptionWhenSettingAnInvalidArgument()
 {
     $instance = new Product();
     $instance->setName(1);
 }
 public function testName()
 {
     $this->assertSame($this->entity, $this->entity->setName('Foo'));
     $this->assertSame('Foo', $this->entity->getName());
     $this->assertSame('Foo', $this->entity->__toString());
 }
예제 #13
0
 public function importProducts(Import $entity, $output)
 {
     $sql = ' SELECT p.*, o.nombre as opticName, m.nombre as brand, mo.nombre as model, s.nombre as category FROM  `producto` AS p ' . ' LEFT JOIN optica AS o ON o.id = p.id_optica ' . ' LEFT JOIN servicio AS s ON s.id = p.id_servicio ' . ' LEFT JOIN marca AS m ON m.id_marca = p.id_marca ' . ' LEFT JOIN modelo AS mo ON mo.id_modelo = p.id_modelo ' . ' ORDER BY p.id ' . ' LIMIT ' . $entity->getLimitStart() . ', ' . $entity->getLimitEnd();
     $link = mysqli_connect($entity->getServer(), $entity->getUsername(), $entity->getPassword(), $entity->getDbname()) or die('No se pudo conectar: ' . mysqli_error($link));
     $resultado = $link->query($sql);
     $x = 0;
     if (mysqli_num_rows($resultado) > 0) {
         while ($fila = mysqli_fetch_assoc($resultado)) {
             $x++;
             print_r($x . '-' . utf8_encode($fila['nombre']));
             echo PHP_EOL;
             $em = $this->container->get('doctrine')->getManager();
             $optic = $em->getRepository('CoreBundle:Optic')->findOneByName(utf8_encode($fila['opticName']));
             $category = $em->getRepository('EcommerceBundle:Category')->findOneByName(utf8_encode($fila['category']));
             $brand = $em->getRepository('EcommerceBundle:Brand')->findOneByName(utf8_encode($fila['brand']));
             $model = $em->getRepository('EcommerceBundle:BrandModel')->findOneByName(utf8_encode($fila['model']));
             //Create Products
             if ($optic instanceof Optic && $fila['id'] != 746 && $fila['id'] != 747 && $fila['id'] != 748 && $fila['id'] != 749 && $fila['id'] != 750 && $fila['id'] != 751 && $fila['id'] != 752 && $fila['id'] != 753) {
                 $product = new Product();
                 $product->setName(utf8_encode($fila['nombre']));
                 $product->setDescription(utf8_encode($fila['descripcion']));
                 if ($fila['precio_original'] != '') {
                     $product->setInitPrice($fila['precio_original']);
                 } else {
                     $product->setInitPrice(0);
                 }
                 $product->setPrice($fila['precio']);
                 if ($fila['tipo_precio'] != '') {
                     $product->setPriceType($fila['tipo_precio']);
                 } else {
                     $product->setPriceType(0);
                 }
                 $product->setDiscount($fila['descuento']);
                 $product->setDiscountType($fila['tipo_descuento']);
                 if ($fila['stock'] != '') {
                     $product->setStock($fila['stock']);
                 } else {
                     $product->setStock(0);
                 }
                 $product->setWeight($fila['kilos']);
                 $product->setOutlet($fila['outlet']);
                 $product->setPublic($fila['publicado']);
                 if ($fila['recoger_tienda'] != '') {
                     $product->setStorePickup($fila['recoger_tienda']);
                 } else {
                     $product->setStorePickup(0);
                 }
                 $product->setMetaTitle(utf8_encode($fila['meta_titulo']));
                 $product->setMetaDescription(utf8_encode($fila['meta_descripcion']));
                 $product->setMetaTags(utf8_encode($fila['meta_keywords']));
                 $product->setOptic($optic);
                 $product->setBrand($brand);
                 $product->setModel($model);
                 $product->setCategory($category);
                 $product->setActive(true);
                 $product->setAvailable(true);
                 $product->setHighlighted(false);
                 $product->setFreeTransport(false);
                 $slug = $this->slugify(utf8_encode($fila['nombre'] . '-' . $optic->getCity()));
                 //                    $p = $em->getRepository('EcommerceBundle:Product')->findOneBySlug($slug);
                 //                    if($p instanceof Product) $slug = $slug.'_'.rand(1000,9999);
                 $product->setSlug($slug);
                 $em->persist($product);
                 $em->flush();
                 //image
                 if ($fila['imagen'] != '') {
                     $imagePath = '';
                     $dir = '/home/sebastian/www/src/Symfony/web/uploads/documents';
                     $absoluteImagePath = $dir . '/' . utf8_encode($fila['imagen']);
                     if (file_exists($absoluteImagePath . '.jpeg')) {
                         $imagePath = utf8_encode($fila['imagen']) . '.jpeg';
                     }
                     if (file_exists($absoluteImagePath . '.jpg')) {
                         $imagePath = utf8_encode($fila['imagen']) . '.jpg';
                     }
                     if (file_exists($absoluteImagePath . '.gif')) {
                         $imagePath = utf8_encode($fila['imagen']) . '.gif';
                     }
                     if (file_exists($absoluteImagePath . '.png')) {
                         $imagePath = utf8_encode($fila['imagen']) . '.png';
                     }
                     //Thumb
                     $imagePathThumb = '';
                     $absoluteImagePathThumb = $dir . '/' . utf8_encode($fila['imagen']) . '_260.jpg';
                     if (file_exists($absoluteImagePathThumb)) {
                         $imagePathThumb = utf8_encode($fila['imagen']) . '_260.jpg';
                     }
                     $imagePathThumb2 = '';
                     $absoluteImagePathThumb2 = $dir . '/' . utf8_encode($fila['imagen']) . '_142.jpg';
                     if (file_exists($absoluteImagePathThumb2)) {
                         $imagePathThumb2 = utf8_encode($fila['imagen']) . '_142.jpg';
                     }
                     if ($imagePath == '') {
                         $dir = 'http://web.com/uploads/documents/';
                         $imagePath = $fila['imagen'] . '.' . $fila['extension_img'];
                     }
                     print_r($dir . '/' . $imagePath);
                     echo PHP_EOL;
                     @mkdir(__DIR__ . '/../../../../../web/uploads/images/product');
                     @mkdir(__DIR__ . '/../../../../../web/uploads/images/product/' . $product->getId());
                     @mkdir(__DIR__ . '/../../../../../web/uploads/images/product/' . $product->getId() . '/thumbnail');
                     copy($dir . '/' . $imagePath, __DIR__ . '/../../../../../web/uploads/images/product/' . $product->getId() . '/' . $imagePath);
                     if ($imagePathThumb != '') {
                         copy($dir . '/' . $imagePathThumb, __DIR__ . '/../../../../../web/uploads/images/product/' . $product->getId() . '/thumbnail/' . $imagePathThumb);
                     }
                     if ($imagePathThumb2 != '') {
                         copy($dir . '/' . $imagePathThumb2, __DIR__ . '/../../../../../web/uploads/images/product/' . $product->getId() . '/thumbnail/' . $imagePathThumb2);
                     }
                     $image0 = new Image();
                     $image0->setPath($imagePath);
                     $product->addImage($image0);
                     $em->persist($image0);
                 }
                 $em->flush();
             }
         }
     }
 }
예제 #14
0
$pro->setCategory("asdf");
// 设置商品类型
$pro->setCommissionType("A");
// 设置佣金类型,如:普通商品 佣金比例是10%、佣金编号(可自行定义然后通知双方商务)A
$pro->setAmount("1");
// 设置商品数量
$pro->setPrice("3000");
// 设置商品价格
$pro1 = new Product();
// $pro1 -> setOrderNo($order -> getOrderNo());
$pro1->setProductNo("1002");
$pro1->setName("测试商品5");
$pro1->setCategory("a");
$pro1->setCommissionType("B");
$pro1->setAmount("3");
$pro1->setPrice("100");
$pro2 = new Product();
// $pro2 -> setOrderNo($order -> getOrderNo());
$pro2->setProductNo("1003");
$pro2->setName("测试商品4");
$pro2->setCategory("2");
$pro2->setCommissionType("B");
$pro2->setAmount("5");
$pro2->setPrice("500");
$products = array($pro, $pro1, $pro2);
// 实现商品信息集合
$order->setProducts($products);
//var_dump(get_object_vars($order));
$sender = new Sender();
$sender->setOrder($order);
$sender->sendOrder();
 public function setName($name)
 {
     $this->__load();
     return parent::setName($name);
 }
예제 #16
0
 public function parseProducts()
 {
     $products = new Products();
     $keyParams = array();
     $currencies = $this->parseCurrencies();
     $measurements = $this->parseMeasurements();
     foreach ($this->xmlProducts as $xmlProduct) {
         $code = $xmlProduct->getCode();
         $name = $xmlProduct->getName();
         $isAGroup = $xmlProduct->isAGroup();
         $articul = $xmlProduct->getArticul();
         $basicMeasurementUnitCode = $xmlProduct->getBasicMeasurementUnit();
         $basicMeasurementUnit = $measurements->getUnitByCode($basicMeasurementUnitCode);
         $price = $xmlProduct->getPrice();
         $currencyCode = $xmlProduct->getCurrency();
         $currency = $currencies->getUnitByCode($currencyCode);
         $measurementUnitCode = $xmlProduct->getBasicMeasurementUnit();
         $measurementUnit = $measurements->getUnitByCode($measurementUnitCode);
         if (!empty($code) && !in_array($code, $keyParams)) {
             array_push($keyParams, $code);
             $product = new Product();
             $product->setIsAGroup($isAGroup);
             $product->setCode($code);
             $product->setName($name);
             $product->setArticul($articul);
             $product->setBasicMeasurementUnit($basicMeasurementUnit);
             $product->setPrice($price);
             $currency == null ? '' : $product->setCurrency($currency);
             $measurementUnit == null ? '' : $product->setMeasurementUnit($measurementUnit);
             $products->setItem($product);
         }
     }
     $categories = $this->parseCategories();
     foreach ($this->xmlProducts as $xmlProduct) {
         $catCode = $xmlProduct->getCategoryCode();
         $code = $xmlProduct->getCode();
         $current = $products->getItemByCode($code);
         $parent = $categories->getItemByCode($catCode);
         if ($parent != null) {
             $current->setParent($parent);
         }
     }
     $productDAO = new ProductDAO();
     $productDAO->insertItems($products);
     return $products;
 }
예제 #17
0
 /**
  * @param $productID
  * @return Product
  */
 public function getProduct($productID)
 {
     APIWrapper::verifyReadiness();
     $requestURL = "https://app.fetchapp.com/api/v2/products/" . $productID;
     $product = APIWrapper::makeRequest($requestURL, "GET");
     if (is_a($product, "SimpleXMLElement")) {
         $tempProduct = new Product();
         $tempProduct->setProductID($product->id);
         $tempProduct->setSKU($product->sku);
         $tempProduct->setName($product->name);
         $tempProduct->setPrice($product->price);
         $tempProduct->setCurrency(Currency::getValue($product->currency));
         $tempProduct->setOrderCount($product->order_count);
         $tempProduct->setDownloadCount($product->download_count);
         $tempProduct->setPaypalAddToCartLink($product->paypal_add_to_cart_link['href']);
         $tempProduct->setPaypalBuyNowLink($product->paypal_buy_now_link['href']);
         $tempProduct->setPaypalViewCartLink($product->paypal_view_cart_link['href']);
         $tempProduct->setCreationDate(new \DateTime($product->created_at));
         $tempProduct->setFilesUri($product->files_uri);
         $tempProduct->setDownloadsUri($product->downloads_uri);
     }
     return $tempProduct;
 }
예제 #18
0
<?php

$entityManager = (require_once __DIR__ . '/bootstrap.php');
$product = new Product();
$product->setName($argv[1]);
$entityManager->persist($product);
$entityManager->flush();
printf("Created product with id=%d\n", $product->getId());
예제 #19
0
파일: index.php 프로젝트: j-jm/web182
        header("Location: .?category_id={$category_id}");
    } else {
        if ($action == 'show_add_form') {
            $categories = $categoryDB->getCategories();
            include 'product_add.php';
        } else {
            if ($action == 'add_product') {
                $category_id = filter_input(INPUT_POST, 'category_id', FILTER_VALIDATE_INT);
                $code = filter_input(INPUT_POST, 'code');
                $name = filter_input(INPUT_POST, 'name');
                $price = filter_input(INPUT_POST, 'price');
                if ($category_id == NULL || $category_id == FALSE || $code == NULL || $name == NULL || $price == NULL || $price == FALSE) {
                    $error = "Invalid product data. Check all fields and try again.";
                    include '../errors/error.php';
                } else {
                    $current_category = $categoryDB->getCategory($category_id);
                    // Create the Product object
                    $product = new Product();
                    $product->setCategory($current_category);
                    $product->setCode($code);
                    $product->setName($name);
                    $product->setPrice($price);
                    // Add the Product object to the database
                    $productDB->addProduct($product);
                    // Display the Product List page for the current category
                    header("Location: .?category_id={$category_id}");
                }
            }
        }
    }
}
예제 #20
0
<?php

// create_product.php
require_once "bootstrap.php";
require_once 'src/product.php';
require_once 'src/client.php';
// $newProductName = $argv[1];
$product0 = new Product();
$product1 = new Product();
$product2 = new Product();
$product0->setName($argv[1]);
$product1->setName($argv[2]);
$product2->setName($argv[3]);
$client0 = new Client();
$client1 = new Client();
$client2 = new Client();
$client0->setName("Phoenix");
$client1->setName("Kayzen");
$client2->setName("SuperNova");
$client0->setAge(23);
$client1->setAge(21);
$client2->setAge(25);
$client0->products[] = $product0;
$client0->products[] = $product1;
$client0->products[] = $product2;
// $client0->add($product0);
// $client0->add($product1);
// $client0->add($product2);
$client0->products[] = $product0;
$client0->products[] = $product1;
$client0->products[] = $product2;
<?php

// create_product.php
require_once "bootstrap.php";
$newProductName = $argv[1];
$product = new Product();
$product->setName($newProductName);
$entityManager->persist($product);
$entityManager->flush();
echo "Created Product with ID " . $product->getId() . "\n";
 public function executeQuickinput(sfWebRequest $request)
 {
     //this will only handle inputstring and parsing.
     //All other functions will be delegated.
     //---initialize vars-------------------------------------------------------------------------------
     $this->linestrings = array();
     $this->cellstrings = array();
     $this->inputstring = "";
     $this->errors = array();
     $this->messages = array();
     $this->generate = false;
     $this->tested = false;
     //---------case 2: method=get, init vars but do nothing: [ok]---------
     //show empty
     if ($request->getMethod() == "GET") {
     } else {
         $this->inputstring = $request->getParameter("inputstring");
         $this->parse();
         $this->tested = true;
         if ($request->getParameter("submit") == "Save") {
             $this->generate = true;
         }
         //test parsed data
         //var_dump($this->cellstrings);
         //processing:
         //save each item under product type
         //expect 2 columns: producttype and product
         //optional column:price?
         foreach ($this->cellstrings as $row) {
             $producttypename = $row[0];
             $productname = $row[1];
             //check if product exists
             $product = Doctrine_Query::create()->from('Product p')->where('p.name ="' . $productname . '"')->fetchOne();
             if ($product) {
                 $this->errors[] = "Product " . $productname . " already exists.";
             }
             $producttype = null;
             if ($producttypename) {
                 $producttype = Doctrine_Query::create()->from('Producttype pt')->where('pt.path ="' . $producttypename . '"')->fetchOne();
             }
             if (!$producttype) {
                 $this->errors[] = "Producttype " . $producttypename . " not found.";
             }
             if (count($this->errors) == 0) {
                 if ($this->generate) {
                     $product = new Product();
                     $product->setName($productname);
                     if ($producttype) {
                         $product->setProducttypeId($producttype->getId());
                     }
                     $product->save();
                     $this->messages[] = "Product " . $productname . " created.";
                 }
             }
         }
         /*
         			$this->pricelistdata->process($this->cellstrings,$request);
         			$this->producttypedata->process($this->cellstrings);
         			$this->productdata->process($this->cellstrings,$this->producttypedata);
         			$this->quotedata->process($this->cellstrings,$request);
         			$this->productsfromproducttypedata->process($this->cellstrings,$this->producttypedata);
         			
         
         			if($request->getParameter("submit")=="Save" and count($this->errors)==0)
         			{
         				$this->pricelistdata->save();
         				$this->producttypedata->save();
         				$this->productdata->save();
         				$this->quotedata->save();
         			}
         
         			//---update input string-----------------------------------------------------------------------
         			$this->inputstring=
         				$this->pricelistdata->getInputString().
         				$this->producttypedata->getInputString().
         				$this->productdata->getInputString();
         */
     }
 }