Exemple #1
0
 /**
  * Saves the text record with given set of parameters.
  *
  * @param \Aimeos\MW\DB\Statement\Iface $stmt Prepared SQL statement with place holders
  * @param integer $id ID of the product item
  * @param integer $siteid Site ID
  * @param string $refid ID of the text item that contains the text
  * @param string $lang Two letter ISO language code
  * @param string $listtype Type of the referenced text in the list item
  * @param string $reftype Type of the referenced text item
  * @param string $domain Domain the text is from
  * @param string $content Text content to store
  * @param string $date Current timestamp in "YYYY-MM-DD HH:mm:ss" format
  * @param string $editor Name of the editor who stored the product
  */
 protected function saveText(\Aimeos\MW\DB\Statement\Iface $stmt, $id, $siteid, $refid, $lang, $listtype, $reftype, $domain, $content, $date, $editor)
 {
     $stmt->bind(1, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT);
     $stmt->bind(2, $siteid, \Aimeos\MW\DB\Statement\Base::PARAM_INT);
     $stmt->bind(3, $refid);
     $stmt->bind(4, $lang);
     $stmt->bind(5, $listtype);
     $stmt->bind(6, $reftype);
     $stmt->bind(7, $domain);
     $stmt->bind(8, $content);
     $stmt->bind(9, $date);
     //mtime
     $stmt->bind(10, $editor);
     $stmt->bind(11, $date);
     //ctime
     try {
         $stmt->execute()->finish();
     } catch (\Aimeos\MW\DB\Exception $e) {
     }
     // Ignore duplicates
 }
Exemple #2
0
 /**
  * Saves the text items referenced indirectly by products
  *
  * @param \Aimeos\MW\DB\Statement\Iface $stmt Prepared SQL statement with place holders
  * @param \Aimeos\MShop\Common\Item\ListRef\Iface $item Item containing associated text items
  * @param array $listTypes Associative list of item ID / list type code pairs
  * @throws \Aimeos\MShop\Index\Exception If no list type for the item is available
  */
 protected function savePrices(\Aimeos\MW\DB\Statement\Iface $stmt, \Aimeos\MShop\Common\Item\ListRef\Iface $item, array $listTypes)
 {
     $context = $this->getContext();
     $siteid = $context->getLocale()->getSiteId();
     $editor = $context->getEditor();
     $date = date('Y-m-d H:i:s');
     foreach ($item->getRefItems('price') as $refId => $refItem) {
         if (!isset($listTypes[$refId])) {
             $msg = sprintf('List type for price item with ID "%1$s" not available', $refId);
             throw new \Aimeos\MShop\Index\Exception($msg);
         }
         foreach ($listTypes[$refId] as $listType) {
             $stmt->bind(1, $item->getId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT);
             $stmt->bind(2, $siteid, \Aimeos\MW\DB\Statement\Base::PARAM_INT);
             $stmt->bind(3, $refId, \Aimeos\MW\DB\Statement\Base::PARAM_INT);
             $stmt->bind(4, $refItem->getCurrencyId());
             $stmt->bind(5, $listType);
             $stmt->bind(6, $refItem->getType());
             $stmt->bind(7, $refItem->getValue());
             $stmt->bind(8, $refItem->getCosts());
             $stmt->bind(9, $refItem->getRebate());
             $stmt->bind(10, $refItem->getTaxRate());
             $stmt->bind(11, $refItem->getQuantity(), \Aimeos\MW\DB\Statement\Base::PARAM_INT);
             $stmt->bind(12, $date);
             //mtime
             $stmt->bind(13, $editor);
             $stmt->bind(14, $date);
             //ctime
             try {
                 $stmt->execute()->finish();
             } catch (\Aimeos\MW\DB\Exception $e) {
             }
             // Ignore duplicates
         }
     }
 }