/**
  * Resets the required attributes list.
  *
  * @return void
  *
  * @author Sebastian Diel <*****@*****.**>
  * @since 25.01.2013
  */
 public static function resetRequiredAttributes()
 {
     self::$requiredAttributes = array();
 }
 /**
  * Return fields for popup.
  *
  * @return FieldList
  *
  * @author Sascha Koehler <*****@*****.**>
  * @since 21.03.2012
  */
 public function getCMSFields_forPopup()
 {
     $fields = new FieldList();
     $orderId = 0;
     $fields->push(new HiddenField('SilvercartOrderID', '', $orderId));
     $fields->push(new DropdownField('SilvercartProductID', $this->fieldLabel('SilvercartProduct'), SilvercartProduct::get()->map('ID', 'Title')->toArray()));
     $fields->push(new TextField('Quantity', $this->fieldLabel('Quantity'), '1'));
     $this->extend('updateGetCMSFields_forPopup', $fields);
     return $fields;
 }
 /**
  * Builds the DataObject of filtered products
  *
  * @return DataList
  * 
  * @author Sebastian Diel <sdiel@πixeltricks.de>
  * @since 23.09.2014
  */
 public function buildSearchResultProducts()
 {
     $searchResultProducts = $this->searchResultProducts;
     $productsPerPage = $this->getProductsPerPageSetting();
     $SQL_start = $this->getSqlOffset();
     $searchQuery = $this->getSearchQuery();
     $searchTerms = explode(' ', $searchQuery);
     $filter = '';
     $useExtensionResults = $this->extend('updateSearchResult', $searchResultProducts, $searchQuery, $SQL_start);
     if (empty($useExtensionResults)) {
         $this->listFilters['original'] = sprintf('
            "SilvercartProduct"."SilvercartProductGroupID" IS NOT NULL AND
            "SilvercartProduct"."SilvercartProductGroupID" > 0 AND
            "SPGPL"."ID" > 0 AND
            "SilvercartProduct"."isActive" = 1 AND (
                 (
                     "SilvercartProductLanguage"."Title" LIKE \'%s%%\' OR
                     "SilvercartProductLanguage"."ShortDescription" LIKE \'%s%%\' OR
                     "SilvercartProductLanguage"."LongDescription" LIKE \'%s%%\' OR
                     "SilvercartProductLanguage"."Title" LIKE \'%%%s%%\' OR
                     "SilvercartProductLanguage"."ShortDescription" LIKE \'%%%s%%\' OR
                     "SilvercartProductLanguage"."LongDescription" LIKE \'%%%s%%\'
                 ) OR
                "SilvercartProductLanguage"."MetaKeywords" LIKE \'%%%s%%\' OR
                "SilvercartProduct"."ProductNumberShop" LIKE \'%%%s%%\' OR
                "SilvercartProduct"."EANCode" LIKE \'%%%s%%\' OR
                 STRCMP(
                     SOUNDEX("SilvercartProductLanguage"."Title"), SOUNDEX(\'%s\')
                 ) = 0
             )
             ', $searchQuery, $searchQuery, $searchQuery, $searchQuery, $searchQuery, $searchQuery, $searchQuery, $searchQuery, $searchQuery, $searchQuery);
         if (count(self::$registeredFilterPlugins) > 0) {
             foreach (self::$registeredFilterPlugins as $registeredPlugin) {
                 $pluginFilters = $registeredPlugin->filter();
                 if (is_array($pluginFilters)) {
                     $this->listFilters = array_merge($this->listFilters, $pluginFilters);
                 }
             }
         }
         $this->extend('updateListFilters', $this->listFilters, $searchTerms);
         foreach ($this->listFilters as $listFilter) {
             if (empty($filter)) {
                 $filter = $listFilter;
             } else {
                 if (strpos(trim($listFilter), 'AND') !== 0 && strpos(trim($listFilter), 'OR') !== 0) {
                     $listFilter = 'AND ' . $listFilter;
                 }
                 $filter = '(' . $filter . ') ' . $listFilter;
             }
         }
         if (SilvercartProduct::defaultSort() == 'relevance') {
             $sort = '';
         } else {
             $sort = SilvercartProduct::defaultSort();
         }
         $searchResultProductsRaw = SilvercartProduct::getProducts($filter, $sort, array(array('table' => 'SilvercartProductGroupPage_Live', 'on' => '"SPGPL"."ID" = "SilvercartProduct"."SilvercartProductGroupID"', 'alias' => 'SPGPL')));
         $searchResultProducts = new PaginatedList($searchResultProductsRaw, $this->getRequest());
         $searchResultProducts->setPageStart($SQL_start);
         $searchResultProducts->setPageLength($productsPerPage);
     }
     $this->searchResultProducts = $searchResultProducts;
     $this->totalNumberOfProducts = $searchResultProducts->count();
     $searchQueryObject = SilvercartSearchQuery::get_by_query(Convert::raw2sql($searchQuery));
     if ($searchQueryObject->Hits != $this->totalNumberOfProducts) {
         $searchQueryObject->Hits = $this->totalNumberOfProducts;
         $searchQueryObject->write();
     }
     return $this->searchResultProducts;
 }
 /**
  * Deletes the existing images of the given product.
  * 
  * @param SilvercartProduct $product Product to delete images for
  * 
  * @return void
  *
  * @author Sebastian Diel <*****@*****.**>
  * @since 25.07.2016
  */
 protected function deleteExistingImages(SilvercartProduct $product)
 {
     foreach ($product->SilvercartImages() as $existingImage) {
         /* @var $existingImage SilvercartImage */
         $existingImage->delete();
     }
 }
 /**
  * handles the requested action.
  * If a product detail view is requested, the detail view template will be
  * rendered an displayed.
  *
  * @param SS_HTTPRequest $request request data
  * @param string         $action  Action
  *
  * @return mixed
  * 
  * @author Sebastian Diel <*****@*****.**>
  * @since 03.03.2014
  */
 public function handleAction($request, $action)
 {
     if (is_numeric($this->urlParams['Action'])) {
         $this->urlParams['Action'] = (int) $this->urlParams['Action'];
         $product = SilvercartProduct::get()->byID(Convert::raw2sql($this->urlParams['Action']));
         if ($product instanceof SilvercartProduct) {
             $this->redirect($product->Link());
             return;
         }
     } elseif ($this->isFilteredByManufacturer()) {
         $url = str_replace($this->urlParams['Action'] . '/' . $this->urlParams['ID'], '', $_REQUEST['url']);
         $this->urlParams['Action'] = '';
         $this->urlParams['ID'] = '';
         $customRequest = new SS_HTTPRequest('GET', $url, array(), array(), null);
         return parent::handleAction($customRequest, $action);
         exit;
     }
     return parent::handleAction($request, $action);
 }
 /**
  * creates test data on /dev/build or by adding test data in ModelAdmin.
  *
  * @return bool
  *
  * @author Sebastian Diel <*****@*****.**>
  * @since 02.07.2011
  */
 public static function createTestData()
 {
     if (self::$enableTestData === true) {
         if (SiteTree::get_by_link(_t('SilvercartTestData.PRODUCTGROUPPAYMENT_URLSEGMENT'))) {
             // test data already created
             return false;
         }
         self::createTestTaxRates();
         // get SilvercartProductGroupHolder and tax rate
         $silvercartProductGroupHolder = SilvercartProductGroupHolder::get()->first();
         $taxRateID = SilvercartTax::get()->filter('Rate', '19')->first()->ID;
         //create a manufacturer
         $manufacturer = new SilvercartManufacturer();
         $manufacturer->Title = 'pixeltricks GmbH';
         $manufacturer->URL = 'http://www.pixeltricks.de/';
         $manufacturer->write();
         //create product groups
         $productGroupPayment = new SilvercartProductGroupPage();
         $productGroupPayment->Title = _t('SilvercartTestData.PRODUCTGROUPPAYMENT_TITLE');
         $productGroupPayment->URLSegment = _t('SilvercartTestData.PRODUCTGROUPPAYMENT_URLSEGMENT');
         $productGroupPayment->Content = _t('SilvercartTestData.PRODUCTGROUP_CONTENT');
         $productGroupPayment->Status = "Published";
         $productGroupPayment->IdentifierCode = 'SilvercartProductGroupPayment';
         $productGroupPayment->ParentID = $silvercartProductGroupHolder->ID;
         $productGroupPayment->ShowInMenus = true;
         $productGroupPayment->ShowInSearch = true;
         $productGroupPayment->Sort = 1;
         $productGroupPayment->write();
         $productGroupPayment->publish("Live", "Stage");
         $productGroupMarketing = new SilvercartProductGroupPage();
         $productGroupMarketing->Title = _t('SilvercartTestData.PRODUCTGROUPMARKETING_TITLE');
         $productGroupMarketing->URLSegment = _t('SilvercartTestData.PRODUCTGROUPMARKETING_URLSEGMENT');
         $productGroupMarketing->Content = _t('SilvercartTestData.PRODUCTGROUP_CONTENT');
         $productGroupMarketing->Status = "Published";
         $productGroupMarketing->IdentifierCode = 'SilvercartproductGroupMarketing';
         $productGroupMarketing->ParentID = $silvercartProductGroupHolder->ID;
         $productGroupMarketing->ShowInMenus = true;
         $productGroupMarketing->ShowInSearch = true;
         $productGroupMarketing->Sort = 2;
         $productGroupMarketing->write();
         $productGroupMarketing->publish("Live", "Stage");
         $productGroupOthers = new SilvercartProductGroupPage();
         $productGroupOthers->Title = _t('SilvercartTestData.PRODUCTGROUPOTHERS_TITLE');
         $productGroupOthers->URLSegment = _t('SilvercartTestData.PRODUCTGROUPOTHERS_URLSEGMENT');
         $productGroupOthers->Content = _t('SilvercartTestData.PRODUCTGROUP_CONTENT');
         $productGroupOthers->Status = "Published";
         $productGroupOthers->IdentifierCode = 'SilvercartproductGroupOthers';
         $productGroupOthers->ParentID = $silvercartProductGroupHolder->ID;
         $productGroupOthers->ShowInMenus = true;
         $productGroupOthers->ShowInSearch = true;
         $productGroupOthers->Sort = 3;
         $productGroupOthers->write();
         $productGroupOthers->publish("Live", "Stage");
         // Define products
         $products = array(array('en_US' => array('Title' => 'Paypal', 'ShortDescription' => 'The world' . "'" . 's most loved way to pay and get paid.', 'LongDescription' => 'PayPal works behind the scenes to help protect you and your customers. Your customers will love the speed of PayPal streamlined checkout experience. And you will love the sales boost PayPal can deliver. PayPal is ideal for selling overseas. You can accept payments in 22 currencies from 190 countries and markets worldwide. Source: www.paypal.com', 'MetaDescription' => 'The world' . "'" . 's most loved way to pay and get paid.', 'MetaKeywords' => 'SilverCart, modules, PayPal, payment', 'MetaTitle' => 'Paypal'), 'en_GB' => array('Title' => 'Paypal', 'ShortDescription' => 'The world' . "'" . 's most loved way to pay and get paid.', 'LongDescription' => 'PayPal works behind the scenes to help protect you and your customers. Your customers will love the speed of PayPal streamlined checkout experience. And you will love the sales boost PayPal can deliver. PayPal is ideal for selling overseas. You can accept payments in 22 currencies from 190 countries and markets worldwide. Source: www.paypal.com', 'MetaDescription' => 'The world' . "'" . 's most loved way to pay and get paid.', 'MetaKeywords' => 'SilverCart, modules, PayPal, payment', 'MetaTitle' => 'Paypal'), 'de_DE' => array('Title' => 'Paypal', 'ShortDescription' => 'PayPal ist sicherererer. Für Daten, für Einkäufe - Für alles', 'LongDescription' => 'PayPal für Ihren Shop Sie haben einen Online-Shop und fragen sich, warum Sie PayPal anbieten sollen? Ganz einfach: Ihre Kunden bezahlen mit nur zwei Klicks. Sie schließen den Kauf zufrieden ab, kommen gerne wieder - und Sie steigern Ihren Umsatz! Das kann PayPal für Sie tun – und mehr!', 'MetaDescription' => 'PayPal ist sicherererer. Für Daten, für Einkäufe - Für alles', 'MetaKeywords' => 'SilverCart, Modul, PayPal, Zahlart', 'MetaTitle' => 'Paypal'), 'PriceGrossAmount' => 9.99, 'PriceGrossCurrency' => _t('SilvercartTestData.CURRENCY'), 'PriceNetAmount' => 9.99 / 119 * 100, 'PriceNetCurrency' => _t('SilvercartTestData.CURRENCY'), 'MSRPriceAmount' => 9.99 / 100 * 120, 'MSRPriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'PurchasePriceAmount' => 9.99, 'PurchasePriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'Weight' => 250, 'StockQuantity' => 5, 'ProductNumberShop' => '10001', 'ProductNumberManufacturer' => 'SC_Mod_100', 'SilvercartProductGroupID' => $productGroupPayment->ID, 'productImage' => 'logopaypal.jpg'), array('en_US' => array('Title' => 'iPayment', 'ShortDescription' => 'iPayment is one of the largest providers of credit and debit card-based payment processing services in the country, processing more than $30 billion in credit and debit card volume annually.', 'LongDescription' => '<p>Receive best in class service no matter what size your business is, with iPayment. We’re committed to making your business more successful by delivering credit and debit card-based payment processing services that are customized to suit your needs.</p><ul><li>Major credit cards: MasterCard®, Visa®, American Express®, Discover® and JCB®</li><li>PIN-secured and signature debit cards</li><li>Gift and loyalty cards</li><li>Petroleum services</li><li>Paper and electronic check services</li><li>Cash advance funding program</li></ul><p><small>Source: www.ipaymentinc.com/</small></p>', 'MetaDescription' => 'iPayment is one of the largest providers of credit and debit card-based payment processing services in the country, processing more than $30 billion in credit and debit card volume annually.', 'MetaKeywords' => 'SilverCart, modules, iPayment, payment', 'MetaTitle' => 'iPayment'), 'en_GB' => array('Title' => 'iPayment', 'ShortDescription' => 'iPayment is one of the largest providers of credit and debit card-based payment processing services in the country, processing more than $30 billion in credit and debit card volume annually.', 'LongDescription' => '<p>Receive best in class service no matter what size your business is, with iPayment. We’re committed to making your business more successful by delivering credit and debit card-based payment processing services that are customized to suit your needs.</p><ul><li>Major credit cards: MasterCard®, Visa®, American Express®, Discover® and JCB®</li><li>PIN-secured and signature debit cards</li><li>Gift and loyalty cards</li><li>Petroleum services</li><li>Paper and electronic check services</li><li>Cash advance funding program</li></ul><p><small>Source: www.ipaymentinc.com/</small></p>', 'MetaDescription' => 'iPayment is one of the largest providers of credit and debit card-based payment processing services in the country, processing more than $30 billion in credit and debit card volume annually.', 'MetaKeywords' => 'SilverCart, modules, iPayment, payment', 'MetaTitle' => 'iPayment'), 'de_DE' => array('Title' => 'iPayment', 'ShortDescription' => 'iPayment unterstützt Ihren Geschäftserfolg im Internet, indem es Ihren Kunden die sichere Bezahlung per Kreditkarte, internetbasiertem elektronischen Lastschriftverfahren und weiteren Zahlungsmedien ermöglicht.', 'LongDescription' => 'ipayment unterstützt Ihren Geschäftserfolg im Internet, indem es Ihren Kunden die sichere Bezahlung per Kreditkarte, internetbasiertem elektronischen Lastschriftverfahren und weiteren Zahlungsmedien ermöglicht. Je nach genutztem Zahlungsanbieter können Sie Ihren Kunden über ipayment die Bezahlung mit folgenden Zahlungsmedien anbieten: Visa MasterCard Maestro American Express JCB Diners Club Visa Electron Solo Internetbasiertes Elektronisches Lastschriftverfahren (ELV) paysafecard Das Unternehmen, über das Sie Ihre Onlinezahlungen abwickeln möchten, können Sie dabei selbst auswählen - ipayment verfügt über Schnittstellen zu den wichtigsten Zahlungsanbietern. Sie schließen den Akzeptanzvertrag mit dem Anbieter Ihrer Wahl - ipayment sorgt für die reibungslose und sichere Abwicklung! Dazu nimmt ipayment die Zahlungsvorgänge direkt aus Ihrem System auf und verarbeitet sie im Hochleistungsrechenzentrum von 1&1 in Karlsruhe. Selbstverständlich erfüllt ipayment dabei die Zertifizierungsanforderungen gemäß dem PCI DSS (Payment Card Industry Data Security Standard). ', 'MetaDescription' => 'iPayment unterstützt Ihren Geschäftserfolg im Internet, indem es Ihren Kunden die sichere Bezahlung per Kreditkarte, internetbasiertem elektronischen Lastschriftverfahren und weiteren Zahlungsmedien ermöglicht.', 'MetaKeywords' => 'SilverCart, Module, iPayment, Zahlart', 'MetaTitle' => 'iPayment'), 'PriceGrossAmount' => 18.99, 'PriceGrossCurrency' => _t('SilvercartTestData.CURRENCY'), 'PriceNetAmount' => 18.99 / 119 * 100, 'PriceNetCurrency' => _t('SilvercartTestData.CURRENCY'), 'MSRPriceAmount' => 18.99 / 100 * 120, 'MSRPriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'PurchasePriceAmount' => 18.99, 'PurchasePriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'Weight' => 260, 'StockQuantity' => 3, 'ProductNumberShop' => '10002', 'ProductNumberManufacturer' => 'SC_Mod_101', 'SilvercartProductGroupID' => $productGroupPayment->ID, 'productImage' => 'logoipayment.gif'), array('en_US' => array('Title' => 'Saferpay', 'ShortDescription' => 'Saferpay has set the standard for e-payment solutions in German-speaking Europe.', 'LongDescription' => '<h3>Saferpay e-payment solutions for professionals and beginners</h3><p>Saferpay integrates all popular payment means in your Web shop through a single interface. This makes it easy to make adaptations and upgrades. What’s more, Saferpay enables the secure online processing of written and phone orders.</p><h3>More payment means – more turnover!</h3><p>Boost your turnover by offering a variety of payment means! With Saferpay you can offer your customers all popular payment means through a single interface, flexibly, easily & securely! You can accept all popular credit cards and debit cards with Saferpay and can activate new payment means at any time or deactivate existing ones and thus can flexibly react to your e-commerce requirements.</p><h3>More profit with security!</h3><p>SIX Card Solutions offers you comprehensive solutions from a single source to handle cashless, electronic payment processing as a merchant in e-commerce or in the phone/mail-order business as securely and conveniently as possible. The e-payment solution supports all current security standards. Increase confidence among your customers!</p>', 'MetaDescription' => 'Saferpay has set the standard for e-payment solutions in German-speaking Europe.', 'MetaKeywords' => 'SilverCart, modules, Saferpay, payment', 'MetaTitle' => 'Saferpay'), 'en_GB' => array('Title' => 'Saferpay', 'ShortDescription' => 'Saferpay has set the standard for e-payment solutions in German-speaking Europe.', 'LongDescription' => '<h3>Saferpay e-payment solutions for professionals and beginners</h3><p>Saferpay integrates all popular payment means in your Web shop through a single interface. This makes it easy to make adaptations and upgrades. What’s more, Saferpay enables the secure online processing of written and phone orders.</p><h3>More payment means – more turnover!</h3><p>Boost your turnover by offering a variety of payment means! With Saferpay you can offer your customers all popular payment means through a single interface, flexibly, easily & securely! You can accept all popular credit cards and debit cards with Saferpay and can activate new payment means at any time or deactivate existing ones and thus can flexibly react to your e-commerce requirements.</p><h3>More profit with security!</h3><p>SIX Card Solutions offers you comprehensive solutions from a single source to handle cashless, electronic payment processing as a merchant in e-commerce or in the phone/mail-order business as securely and conveniently as possible. The e-payment solution supports all current security standards. Increase confidence among your customers!</p>', 'MetaDescription' => 'Saferpay has set the standard for e-payment solutions in German-speaking Europe.', 'MetaKeywords' => 'SilverCart, modules, Saferpay, payment', 'MetaTitle' => 'Saferpay'), 'de_DE' => array('Title' => 'Saferpay', 'ShortDescription' => 'Saferpay hat im deutschsprachigen Europa den Standard für E-Payment-Lösungen gesetzt und steht damit als Synonym für "sicheres Bezahlen im Internet."', 'LongDescription' => '<h3>Saferpay E-Payment-Lösungen für Profis und Einsteiger</h3><p>Saferpay hat im deutschsprachigen Europa den Standard für E-Payment-Lösungen gesetzt und steht damit als Synonym für "sicheres Bezahlen im Internet." Dank Saferpay müssen sich Online-Händler wie Karteninhaber über die Sicherheit beim Einkaufen im Internet keine Sorgen mehr machen. Händler kennen und schätzen das sichere Bezahlen im Internet über Saferpay weltweit.</p><p>Saferpay integriert alle gängigen Zahlungsmittel in Ihren Webshop - über eine einzige Schnittstelle. Dadurch sind Anpassungen und Erweiterungen problemlos umsetzbar. Darüber hinaus ermöglicht Saferpay die sichere Onlineabwicklung von schriftlichen und telefonischen Bestellungen.</p><h3>Mehr Zahlungsmittel – mehr Umsatz!</h3><p>Steigern Sie Ihren Umsatz durch das Angebot einer Vielzahl an Zahlungsmitteln! Mit Saferpay bieten Sie Ihren Kunden alle gängigen Zahlungsmittel über eine einzige Schnittstelle – flexibel, einfach & sicher! Mit Saferpay können Sie alle gängigen Kreditkarten und Debitkarten akzeptieren. Sie können jederzeit neue Zahlungsmittel aufschalten oder bestehende wieder abschalten und somit flexibel auf die Bedürfnisse im E-Commerce reagieren.</p><h3>Mit Sicherheit mehr Gewinn!</h3><p>Um die bargeldlose, elektronische Zahlungsabwicklung für Sie als Händler im E-Commerce oder Phone-/Mail-Order Business so sicher und bequem wie möglich zu machen, bietet die SIX Card Solutions Ihnen als Händler Komplettlösungen aus einer Hand. Die E-Payment-Lösung unterstützt alle heutigen Sicherheitsstandards. Stärken Sie das Vertrauen Ihrer Kunden !</p>', 'MetaDescription' => 'Saferpay hat im deutschsprachigen Europa den Standard für E-Payment-Lösungen gesetzt und steht damit als Synonym für "sicheres Bezahlen im Internet."', 'MetaKeywords' => 'SilverCart, Module, Saferpay, Zahlart', 'MetaTitle' => 'Saferpay'), 'PriceGrossAmount' => 36.99, 'PriceGrossCurrency' => _t('SilvercartTestData.CURRENCY'), 'PriceNetAmount' => 36.99 / 119 * 100, 'PriceNetCurrency' => _t('SilvercartTestData.CURRENCY'), 'MSRPriceAmount' => 36.99 / 100 * 120, 'MSRPriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'PurchasePriceAmount' => 36.99, 'PurchasePriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'Weight' => 270, 'StockQuantity' => 12, 'ProductNumberShop' => '10003', 'ProductNumberManufacturer' => 'SC_Mod_102', 'SilvercartProductGroupID' => $productGroupPayment->ID, 'productImage' => 'logosaferpay.jpg'), array('en_US' => array('Title' => 'Prepayment', 'ShortDescription' => 'Flexible payment system for all payment systems which don' . "'" . 't need any automated logic.', 'LongDescription' => 'Flexible payment system for all payment systems which don' . "'" . 't need any automated logic. This module provides beside prepayment also payment via invoice.', 'MetaDescription' => 'Flexible payment system for all payment systems which don' . "'" . 't need any automated logic.', 'MetaKeywords' => 'SilverCart, modules, Prepayment, payment', 'MetaTitle' => 'Prepayment'), 'en_GB' => array('Title' => 'Prepayment', 'ShortDescription' => 'Flexible payment system for all payment systems which don' . "'" . 't need any automated logic.', 'LongDescription' => 'Flexible payment system for all payment systems which don' . "'" . 't need any automated logic. This module provides beside prepayment also payment via invoice.', 'MetaDescription' => 'Flexible payment system for all payment systems which don' . "'" . 't need any automated logic.', 'MetaKeywords' => 'SilverCart, modules, Prepayment, payment', 'MetaTitle' => 'Prepayment'), 'de_DE' => array('Title' => 'Vorkasse', 'ShortDescription' => 'Flexibles Zahlungs-Modul für alle Zahlungsarten, die keine automatisierte Logik erfordern.', 'LongDescription' => 'Flexibles Zahlungs-Modul für alle Zahlungsarten, die keine automatisierte Logik erfordern. Dieses Modul bietet neben der Vorkasse auch Rechnung als Zahlungsart.', 'MetaDescription' => 'Flexibles Zahlungs-Modul für alle Zahlungsarten, die keine automatisierte Logik erfordern.', 'MetaKeywords' => 'SilverCart, Module, Prepayment, Zahlart', 'MetaTitle' => 'Vorkasse'), 'PriceGrossAmount' => 27.99, 'PriceGrossCurrency' => _t('SilvercartTestData.CURRENCY'), 'PriceNetAmount' => 27.99 / 119 * 100, 'PriceNetCurrency' => _t('SilvercartTestData.CURRENCY'), 'MSRPriceAmount' => 27.99 / 100 * 120, 'MSRPriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'PurchasePriceAmount' => 27.99, 'PurchasePriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'Weight' => 290, 'StockQuantity' => 9, 'ProductNumberShop' => '10004', 'ProductNumberManufacturer' => 'SC_Mod_103', 'SilvercartProductGroupID' => $productGroupPayment->ID, 'productImage' => 'logoprepayment.png'), array('en_US' => array('Title' => 'Cross selling', 'ShortDescription' => 'Cross selling is a practice of suggesting related products or services to a customer who is considering buying something.', 'LongDescription' => 'It is a practice of suggesting related products or services to a customer who is considering buying something. Encourage established customers to buy different but related products. Getting a computer buyer to purchase a printer, for example. Source: www.procopytips.com', 'MetaDescription' => 'Cross selling is a practice of suggesting related products or services to a customer who is considering buying something.', 'MetaKeywords' => 'SilverCart, module, Cross selling, marketing', 'MetaTitle' => 'Cross selling'), 'en_GB' => array('Title' => 'Cross selling', 'ShortDescription' => 'Cross selling is a practice of suggesting related products or services to a customer who is considering buying something.', 'LongDescription' => 'It is a practice of suggesting related products or services to a customer who is considering buying something. Encourage established customers to buy different but related products. Getting a computer buyer to purchase a printer, for example. Source: www.procopytips.com', 'MetaDescription' => 'Cross selling is a practice of suggesting related products or services to a customer who is considering buying something.', 'MetaKeywords' => 'SilverCart, module, Cross selling, marketing', 'MetaTitle' => 'Cross selling'), 'de_DE' => array('Title' => 'Cross-Selling', 'ShortDescription' => 'Kreuzverkauf bezeichnet im Marketing den Verkauf von sich ergänzenden Produkten oder Dienstleistungen.', 'LongDescription' => 'Verkaufs- bzw. Marketinginstrument, bei dem Informationen über bereits existierende Kunden oder über bekanntes Konsumentenverhalten genutzt wird, um zusätzliche Käufe anderer Produkte zu begünstigen. Quelle: www.desig-n.de ', 'MetaDescription' => 'Kreuzverkauf bezeichnet im Marketing den Verkauf von sich ergänzenden Produkten oder Dienstleistungen.', 'MetaKeywords' => 'SilverCart, Modul, Cross-Selling, Marketing', 'MetaTitle' => 'Cross-Selling'), 'PriceGrossAmount' => 12.99, 'PriceGrossCurrency' => _t('SilvercartTestData.CURRENCY'), 'PriceNetAmount' => 12.99 / 119 * 100, 'PriceNetCurrency' => _t('SilvercartTestData.CURRENCY'), 'MSRPriceAmount' => 12.99 / 100 * 120, 'MSRPriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'PurchasePriceAmount' => 12.99, 'PurchasePriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'Weight' => 145, 'StockQuantity' => 26, 'ProductNumberShop' => '10006', 'ProductNumberManufacturer' => 'SC_Mod_104', 'SilvercartProductGroupID' => $productGroupMarketing->ID, 'productImage' => 'logocrossselling.png'), array('en_US' => array('Title' => 'eKomi', 'ShortDescription' => 'Increase sales with eKomi’s trusted independent customer review system!', 'LongDescription' => 'eKomi – The Feedback Company, helps companies through their web-based social SaaS technology with authentic and valuable reviews from customers and helps increasing the customer satisfaction and sales. Generate valuable customer reviews with eKomi' . "'" . 's intelligent, easy to install software and increase sales, trust and customer loyalty. <small>Source: www.ekomi.co.uk</small>', 'MetaDescription' => 'Increase sales with eKomi’s trusted independent customer review system!', 'MetaKeywords' => 'SilverCart, module, Ekomi, marketing', 'MetaTitle' => 'eKomi'), 'en_GB' => array('Title' => 'eKomi', 'ShortDescription' => 'Increase sales with eKomi’s trusted independent customer review system!', 'LongDescription' => 'eKomi – The Feedback Company, helps companies through their web-based social SaaS technology with authentic and valuable reviews from customers and helps increasing the customer satisfaction and sales. Generate valuable customer reviews with eKomi' . "'" . 's intelligent, easy to install software and increase sales, trust and customer loyalty. <small>Source: www.ekomi.co.uk</small>', 'MetaDescription' => 'Increase sales with eKomi’s trusted independent customer review system!', 'MetaKeywords' => 'SilverCart, module, Ekomi, marketing', 'MetaTitle' => 'eKomi'), 'de_DE' => array('Title' => 'eKomi', 'ShortDescription' => 'Mehr Umsatz und Vertrauen durch unabhängige Kunden- und Produktbewertungen!', 'LongDescription' => 'Beginnen Sie noch heute, durch intelligente Kundenbefragung authentisches und wertvolles Kundenfeedback zu gewinnen und damit Ihre Kundenzufriedenheit und Ihren Umsatz zu steigern. ', 'MetaDescription' => 'Mehr Umsatz und Vertrauen durch unabhängige Kunden- und Produktbewertungen!', 'MetaKeywords' => 'SilverCart, Modul, Ekomi, Marketing', 'MetaTitle' => 'eKomi'), 'Title' => _t('SilvercartTestData.PRODUCTMARKETINGEKOMI_TITLE'), 'PriceGrossAmount' => 32.99, 'PriceGrossCurrency' => _t('SilvercartTestData.CURRENCY'), 'PriceNetAmount' => 32.99 / 119 * 100, 'PriceNetCurrency' => _t('SilvercartTestData.CURRENCY'), 'MSRPriceAmount' => 32.99 / 100 * 120, 'MSRPriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'PurchasePriceAmount' => 32.99, 'PurchasePriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'ShortDescription' => _t('SilvercartTestData.PRODUCTMARKETINGEKOMI_SHORTDESC'), 'LongDescription' => _t('SilvercartTestData.PRODUCTMARKETINGEKOMI_LONGDESC'), 'MetaDescription' => _t('SilvercartTestData.PRODUCTMARKETINGEKOMI_SHORTDESC'), 'MetaTitle' => _t('SilvercartTestData.PRODUCTMARKETINGEKOMI_TITLE'), 'MetaKeywords' => _t('SilvercartTestData.PRODUCTMARKETINGEKOMI_KEYWORDS'), 'Weight' => 345, 'StockQuantity' => 146, 'ProductNumberShop' => '10007', 'ProductNumberManufacturer' => 'SC_Mod_105', 'SilvercartProductGroupID' => $productGroupMarketing->ID, 'productImage' => 'logoekomi.jpg'), array('en_US' => array('Title' => 'Protected Shops', 'ShortDescription' => 'Make your online shop more secure! Try the Protected Shops quality rating system to boost your sales!', 'LongDescription' => 'In the online business you will be confronted with unmanageable specifications which can be very expensive if you breach the conditions. Protected Shops offers a quality rating system to boost your sales. 67% of customers trust in a indepented shop ratings. Use the Vote connect interface of Protected Shops to integrate the quality rating system provided by Protected Shops into SilverCart.', 'MetaDescription' => 'Make your online shop more secure! Try the Protected Shops quality rating system to boost your sales!', 'MetaKeywords' => 'SilverCart, modules, ProtectedShops, marketing', 'MetaTitle' => 'Protected Shops'), 'en_GB' => array('Title' => 'Protected Shops', 'ShortDescription' => 'Make your online shop more secure! Try the Protected Shops quality rating system to boost your sales!', 'LongDescription' => 'In the online business you will be confronted with unmanageable specifications which can be very expensive if you breach the conditions. Protected Shops offers a quality rating system to boost your sales. 67% of customers trust in a indepented shop ratings. Use the Vote connect interface of Protected Shops to integrate the quality rating system provided by Protected Shops into SilverCart.', 'MetaDescription' => 'Make your online shop more secure! Try the Protected Shops quality rating system to boost your sales!', 'MetaKeywords' => 'SilverCart, modules, ProtectedShops, marketing', 'MetaTitle' => 'Protected Shops'), 'de_DE' => array('Title' => 'Protected Shops', 'ShortDescription' => 'Machen Sie Ihr Online-Business sicherer! Wer im Internet handelt, kann seinen Umsatz durch das Protected Shops Bewertungssystem steigern. ', 'LongDescription' => 'Wer im Internet handelt, ist mit einer unüberschaubaren Menge rechtlicher Vorgaben konfrontiert, die bei Nichteinhaltung zu einem teuren Unterfangen werden können. Gerade von Konkurrenten, die ihren Mitbewerb durch teuere Abmahnungen zu schädigen versuchen, geht für Ihr Unternehmen eine große Gefahr aus. Wer im Internet handelt, kann seinen Umsatz durch das Protected Shops Bewertungssystem steigern. 67% der Online Käufer vertrauen auf Online-Konsumentenbewertungen (Quelle: www.nielsen.com vom 24.07.2009). Mit unserer Vote Connect Schnittstelle integrieren Sie das Protected Shops Kundenbewertungssystem in Ihren Shop. ', 'MetaDescription' => 'Machen Sie Ihr Online-Business sicherer! Wer im Internet handelt, kann seinen Umsatz durch das Protected Shops Bewertungssystem steigern. ', 'MetaKeywords' => 'SilverCart, Module, ProtectedShops, Marketing', 'MetaTitle' => 'Protected Shops'), 'PriceGrossAmount' => 49.99, 'PriceGrossCurrency' => _t('SilvercartTestData.CURRENCY'), 'PriceNetAmount' => 49.99 / 119 * 100, 'PriceNetCurrency' => _t('SilvercartTestData.CURRENCY'), 'MSRPriceAmount' => 49.99 / 100 * 120, 'MSRPriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'PurchasePriceAmount' => 49.99, 'PurchasePriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'Weight' => 75, 'StockQuantity' => 101, 'ProductNumberShop' => '10008', 'ProductNumberManufacturer' => 'SC_Mod_106', 'SilvercartProductGroupID' => $productGroupMarketing->ID, 'productImage' => 'logoprotectedshops.jpg'), array('en_US' => array('Title' => 'DHL', 'ShortDescription' => 'Packet interface for the shipping provider DHL (EasyLog)', 'LongDescription' => 'Packet interface for the shipping provider DHL. Interface to export ordernumbers into Easylog and import tracking numbers back into SilverCart.', 'MetaDescription' => 'Packet interface for the shipping provider DHL (EasyLog)', 'MetaKeywords' => 'SilverCart, modules, shipping, DHL', 'MetaTitle' => 'DHL'), 'en_GB' => array('Title' => 'DHL', 'ShortDescription' => 'Packet interface for the shipping provider DHL (EasyLog)', 'LongDescription' => 'Packet interface for the shipping provider DHL. Interface to export ordernumbers into Easylog and import tracking numbers back into SilverCart.', 'MetaDescription' => 'Packet interface for the shipping provider DHL (EasyLog)', 'MetaKeywords' => 'SilverCart, modules, shipping, DHL', 'MetaTitle' => 'DHL'), 'de_DE' => array('Title' => 'DHL', 'ShortDescription' => 'Paketschnittstelle zum Versandanbieter DHL (Easylog)', 'LongDescription' => 'Paketschnittstelle zum Versandanbieter DHL für den Export von Bestellungen nach Easylog und den Import von Sendungsnachverfolgungsnummern in SilverCart.', 'MetaDescription' => 'Paketschnittstelle zum Versandanbieter DHL (Easylog)', 'MetaKeywords' => 'SilverCart, Module, Versand, DHL', 'MetaTitle' => 'DHL'), 'PriceGrossAmount' => 27.99, 'PriceGrossCurrency' => _t('SilvercartTestData.CURRENCY'), 'PriceNetAmount' => 27.99 / 119 * 100, 'PriceNetCurrency' => _t('SilvercartTestData.CURRENCY'), 'MSRPriceAmount' => 27.99 / 100 * 120, 'MSRPriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'PurchasePriceAmount' => 27.99, 'PurchasePriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'Weight' => 95, 'StockQuantity' => 12, 'ProductNumberShop' => '10009', 'ProductNumberManufacturer' => 'SC_Mod_107', 'SilvercartProductGroupID' => $productGroupOthers->ID, 'productImage' => 'logodhl.jpg'), array('en_US' => array('Title' => 'PDF Invoice', 'ShortDescription' => 'Automatically generate PDF invoices', 'LongDescription' => 'Automatically generated purchase order as PDF file.', 'MetaDescription' => 'Automatically generate PDF invoices', 'MetaKeywords' => 'SilverCart, modules, PDF invoice', 'MetaTitle' => 'PDF Invoice'), 'en_GB' => array('Title' => 'PDF Invoice', 'ShortDescription' => 'Automatically generate PDF invoices', 'LongDescription' => 'Automatically generated purchase order as PDF file.', 'MetaDescription' => 'Automatically generate PDF invoices', 'MetaKeywords' => 'SilverCart, modules, PDF invoice', 'MetaTitle' => 'PDF Invoice'), 'de_DE' => array('Title' => 'PDF-Rechnung', 'ShortDescription' => 'Automatische Generierung von PDF-Rechnungen', 'LongDescription' => 'Erstellt automatisiert PDF-Rechnungen bei Bestellungen.', 'MetaDescription' => 'Automatische Generierung von PDF-Rechnungen', 'MetaKeywords' => 'SilverCart, Module, PDF-Rechnung', 'MetaTitle' => 'PDF-Rechnung'), 'PriceGrossAmount' => 18.99, 'PriceGrossCurrency' => _t('SilvercartTestData.CURRENCY'), 'PriceNetAmount' => 18.99 / 119 * 100, 'PriceNetCurrency' => _t('SilvercartTestData.CURRENCY'), 'MSRPriceAmount' => 18.99 / 100 * 120, 'MSRPriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'PurchasePriceAmount' => 18.99, 'PurchasePriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'Weight' => 173, 'StockQuantity' => 14, 'ProductNumberShop' => '10011', 'ProductNumberManufacturer' => 'SC_Mod_109', 'SilvercartProductGroupID' => $productGroupOthers->ID, 'productImage' => 'logopdfinvoice.jpg'), array('en_US' => array('Title' => 'Vouchers', 'ShortDescription' => 'Create various vouchers with percentage or absolute price discount plus coupons for products.', 'LongDescription' => 'Create various vouchers with percentage or absolute price discount plus coupons for products.', 'MetaDescription' => 'Create various vouchers with percentage or absolute price discount plus coupons for products.', 'MetaKeywords' => 'SilverCart, modules, vouchers', 'MetaTitle' => 'Vouchers'), 'en_GB' => array('Title' => 'Vouchers', 'ShortDescription' => 'Create various vouchers with percentage or absolute price discount plus coupons for products.', 'LongDescription' => 'Create various vouchers with percentage or absolute price discount plus coupons for products.', 'MetaDescription' => 'Create various vouchers with percentage or absolute price discount plus coupons for products.', 'MetaKeywords' => 'SilverCart, modules, vouchers', 'MetaTitle' => 'Vouchers'), 'de_DE' => array('Title' => 'Gutscheine', 'ShortDescription' => 'Gutscheinerstellung mit prozentualem oder absolutem Rabatt sowie Warengutscheinen.', 'LongDescription' => 'Gutscheinerstellung mit prozentualem oder absolutem Rabatt sowie Warengutscheinen.', 'MetaDescription' => 'Gutscheinerstellung mit prozentualem oder absolutem Rabatt sowie Warengutscheinen.', 'MetaKeywords' => 'Silvercart, Module, Gutscheine', 'MetaTitle' => 'Gutscheine'), 'PriceGrossAmount' => 32.99, 'PriceGrossCurrency' => _t('SilvercartTestData.CURRENCY'), 'PriceNetAmount' => 32.99 / 119 * 100, 'PriceNetCurrency' => _t('SilvercartTestData.CURRENCY'), 'MSRPriceAmount' => 32.99 / 100 * 120, 'MSRPriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'PurchasePriceAmount' => 32.99, 'PurchasePriceCurrency' => _t('SilvercartTestData.CURRENCY'), 'Weight' => 373, 'StockQuantity' => 24, 'ProductNumberShop' => '10012', 'ProductNumberManufacturer' => 'SC_Mod_110', 'SilvercartProductGroupID' => $productGroupOthers->ID, 'productImage' => 'logovouchers.png'));
         // Create folder for product images
         $exampleDataDir = Director::baseFolder() . '/assets/test-images/';
         $imageFolder = new Folder();
         $imageFolder->setName('test-images');
         $imageFolder->write();
         if (!file_exists($exampleDataDir)) {
             mkdir($exampleDataDir);
         }
         $locales = array('de_DE', 'en_GB', 'en_US');
         $fallbackLocale = false;
         if (!in_array(Translatable::get_current_locale(), $locales)) {
             $locales[] = Translatable::get_current_locale();
             $fallbackLocale = Translatable::get_current_locale();
         }
         // Create products
         foreach ($products as $product) {
             $productItem = new SilvercartProduct();
             $productItem->SilvercartTaxID = $taxRateID;
             $productItem->SilvercartManufacturerID = $manufacturer->ID;
             $productItem->Weight = $product['Weight'];
             $productItem->StockQuantity = $product['StockQuantity'];
             $productItem->ProductNumberShop = $product['ProductNumberShop'];
             $productItem->ProductNumberManufacturer = $product['ProductNumberManufacturer'];
             $productItem->SilvercartProductGroupID = $product['SilvercartProductGroupID'];
             $productItem->PriceGrossAmount = $product['PriceGrossAmount'];
             $productItem->PriceGrossCurrency = $product['PriceGrossCurrency'];
             $productItem->PriceNetAmount = $product['PriceNetAmount'];
             $productItem->PriceNetCurrency = $product['PriceNetCurrency'];
             $productItem->MSRPriceAmount = $product['MSRPriceAmount'];
             $productItem->MSRPriceCurrency = $product['MSRPriceCurrency'];
             $productItem->PurchasePriceAmount = $product['PurchasePriceAmount'];
             $productItem->PurchasePriceCurrency = $product['PurchasePriceCurrency'];
             $productItem->write();
             if ($fallbackLocale !== false) {
                 $product[$fallbackLocale] = $product['en_US'];
             }
             //create the language objects for the locales
             foreach ($locales as $locale) {
                 /*
                  * We need to check if a language object exists alredy because
                  * a hook of SilvercartProduct defaultly creates one.
                  */
                 $language = SilvercartProductLanguage::get()->filter(array('SilvercartProductID' => $productItem->ID, 'Locale' => $locale))->first();
                 if (!$language) {
                     $language = new SilvercartProductLanguage();
                     $language->Locale = $locale;
                 }
                 $language->SilvercartProductID = $productItem->ID;
                 if (array_key_exists($locale, $product)) {
                     foreach ($product[$locale] as $attribute => $value) {
                         $language->{$attribute} = $value;
                     }
                 }
                 $language->write();
             }
             // Add product image
             if (array_key_exists('productImage', $product)) {
                 copy(Director::baseFolder() . '/silvercart/img/exampledata/' . $product['productImage'], $exampleDataDir . $product['productImage']);
                 $productImage = new Image();
                 $productImage->setName($product['productImage']);
                 $productImage->setFilename($exampleDataDir . '/' . $product['productImage']);
                 $productImage->setParentID($imageFolder->ID);
                 $productImage->write();
                 $silvercartImage = new SilvercartImage();
                 $silvercartImage->SilvercartProductID = $productItem->ID;
                 $silvercartImage->ImageID = $productImage->ID;
                 $silvercartImage->write();
             }
         }
         // create widget sets
         $widgetSetFrontPageContentArea = new WidgetArea();
         $widgetSetFrontPageContentArea->write();
         $widgetSetFrontPageContent = new WidgetSet();
         $widgetSetFrontPageContent->setField('Title', _t('SilvercartTestData.WIDGETSET_FRONTPAGE_CONTENT_TITLE'));
         $widgetSetFrontPageContent->setField('WidgetAreaID', $widgetSetFrontPageContentArea->ID);
         $widgetSetFrontPageContent->write();
         $widgetSetFrontPageSidebarArea = new WidgetArea();
         $widgetSetFrontPageSidebarArea->write();
         $widgetSetFrontPageSidebar = new WidgetSet();
         $widgetSetFrontPageSidebar->setField('Title', _t('SilvercartTestData.WIDGETSET_FRONTPAGE_SIDEBAR_TITLE'));
         $widgetSetFrontPageSidebar->setField('WidgetAreaID', $widgetSetFrontPageSidebarArea->ID);
         $widgetSetFrontPageSidebar->write();
         $widgetSetProductGroupPagesSidebarArea = new WidgetArea();
         $widgetSetProductGroupPagesSidebarArea->write();
         $widgetSetProductGroupPagesSidebar = new WidgetSet();
         $widgetSetProductGroupPagesSidebar->setField('Title', _t('SilvercartTestData.WIDGETSET_PRODUCTGROUPPAGES_SIDEBAR_TITLE'));
         $widgetSetProductGroupPagesSidebar->setField('WidgetAreaID', $widgetSetProductGroupPagesSidebarArea->ID);
         $widgetSetProductGroupPagesSidebar->write();
         // Attribute widget sets to pages
         $frontPage = SilvercartPage_Controller::PageByIdentifierCode('SilvercartFrontPage');
         if ($frontPage) {
             $frontPage->WidgetSetContent()->add($widgetSetFrontPageContent);
             $frontPage->WidgetSetSidebar()->add($widgetSetFrontPageSidebar);
         }
         $productGroupHolderPage = SilvercartPage_Controller::PageByIdentifierCode('SilvercartProductGroupHolder');
         if ($productGroupHolderPage) {
             $productGroupHolderPage->WidgetSetSidebar()->add($widgetSetProductGroupPagesSidebar);
         }
         // Create Widgets
         $widgetFrontPageContent1 = new SilvercartProductGroupItemsWidget();
         $widgetFrontPageContent1->setField('FrontTitle', _t('SilvercartTestData.WIDGETSET_FRONTPAGE_CONTENT1_TITLE'));
         $widgetFrontPageContent1->setField('FrontContent', _t('SilvercartTestData.WIDGETSET_FRONTPAGE_CONTENT1_CONTENT'));
         $widgetFrontPageContent1->setField('numberOfProductsToShow', 4);
         $widgetFrontPageContent1->setField('SilvercartProductGroupPageID', $productGroupPayment->ID);
         $widgetFrontPageContent1->setField('GroupView', 'tile');
         $widgetFrontPageContent1->setField('isContentView', 1);
         $widgetFrontPageContent1->setField('useSlider', 0);
         $widgetFrontPageContent1->setField('buildArrows', 0);
         $widgetFrontPageContent1->setField('buildNavigation', 1);
         $widgetFrontPageContent1->setField('buildStartStop', 0);
         $widgetFrontPageContent1->setField('slideDelay', 6000);
         $widgetFrontPageContent1->setField('transitionEffect', 'fade');
         $widgetFrontPageContent1->setField('Sort', 2);
         $widgetFrontPageContent1->write();
         $widgetSetFrontPageContentArea->Widgets()->add($widgetFrontPageContent1);
         $widgetFrontPageContent2 = new SilvercartProductGroupItemsWidget();
         $widgetFrontPageContent2->setField('FrontTitle', _t('SilvercartTestData.WIDGETSET_FRONTPAGE_CONTENT2_TITLE'));
         $widgetFrontPageContent2->setField('FrontContent', _t('SilvercartTestData.WIDGETSET_FRONTPAGE_CONTENT2_CONTENT'));
         $widgetFrontPageContent2->setField('numberOfProductsToShow', 1);
         $widgetFrontPageContent2->setField('numberOfProductsToFetch', 4);
         $widgetFrontPageContent2->setField('SilvercartProductGroupPageID', $productGroupOthers->ID);
         $widgetFrontPageContent2->setField('GroupView', 'list');
         $widgetFrontPageContent2->setField('isContentView', 1);
         $widgetFrontPageContent2->setField('useSlider', 1);
         $widgetFrontPageContent2->setField('buildArrows', 0);
         $widgetFrontPageContent2->setField('buildNavigation', 1);
         $widgetFrontPageContent2->setField('buildStartStop', 0);
         $widgetFrontPageContent2->setField('slideDelay', 6000);
         $widgetFrontPageContent2->setField('transitionEffect', 'horizontalSlide');
         $widgetFrontPageContent2->setField('Sort', 3);
         $widgetFrontPageContent2->write();
         $widgetSetFrontPageContentArea->Widgets()->add($widgetFrontPageContent2);
         $widgetFrontPageContent3 = new SilvercartImageSliderWidget();
         $widgetFrontPageContent3->setField('buildArrows', 0);
         $widgetFrontPageContent3->setField('buildNavigation', 1);
         $widgetFrontPageContent3->setField('buildStartStop', 0);
         $widgetFrontPageContent3->setField('slideDelay', 10000);
         $widgetFrontPageContent3->setField('transitionEffect', 'fade');
         $widgetFrontPageContent3->setField('Sort', 0);
         $widgetFrontPageContent3->write();
         $widgetSetFrontPageContentArea->Widgets()->add($widgetFrontPageContent3);
         copy(Director::baseFolder() . '/silvercart/img/exampledata/silvercart_teaser.jpg', $exampleDataDir . '/silvercart_teaser.jpg');
         $teaserImage = new Image();
         $teaserImage->setFilename($exampleDataDir . '/silvercart_teaser.jpg');
         $teaserImage->setParentID($imageFolder->ID);
         $teaserImage->write();
         $slideImage = new SilvercartImageSliderImage();
         #$slideImage->setField('Title',   'Silvercart Teaser');
         $slideImage->setField('ImageID', $teaserImage->ID);
         $slideImage->write();
         $sliderImageTranslations = array('en_GB' => 'SilverCart Teaser', 'en_US' => 'SilverCart Teaser', 'de_DE' => 'SilverCart Teaser');
         $locales = array('de_DE', 'en_GB', 'en_US');
         $fallbackLocale = false;
         if (!in_array(Translatable::get_current_locale(), $locales)) {
             $locales[] = Translatable::get_current_locale();
             $fallbackLocale = Translatable::get_current_locale();
         }
         if ($fallbackLocale !== false) {
             $sliderImageTranslations[$fallbackLocale] = $sliderImageTranslations['en_US'];
         }
         foreach ($sliderImageTranslations as $locale => $translation) {
             $translationObj = SilvercartImageSliderImageLanguage::get()->filter('Locale', $locale)->first();
             if (!$translationObj) {
                 $translationObj = new SilvercartImageSliderImageLanguage();
                 $translationObj->Locale = $locale;
                 $translationObj->SilvercartImageSliderImageID = $slideImage->ID;
             }
             $translationObj->Title = $translation;
             $translationObj->write();
         }
         $widgetFrontPageContent3->slideImages()->add($slideImage);
         $widgetFrontPageSidebar1 = new SilvercartProductGroupItemsWidget();
         $widgetFrontPageSidebar1->setField('numberOfProductsToShow', 3);
         $widgetFrontPageSidebar1->setField('SilvercartProductGroupPageID', $productGroupMarketing->ID);
         $widgetFrontPageSidebar1->setField('useSlider', 0);
         $widgetFrontPageSidebar1->setField('GroupView', 'list');
         $widgetFrontPageSidebar1->setField('isContentView', 0);
         $widgetFrontPageSidebar1->setField('buildArrows', 0);
         $widgetFrontPageSidebar1->setField('buildNavigation', 1);
         $widgetFrontPageSidebar1->setField('buildStartStop', 0);
         $widgetFrontPageSidebar1->setField('slideDelay', 4000);
         $widgetFrontPageSidebar1->setField('transitionEffect', 'horizontalSlide');
         $widgetFrontPageSidebar1->setField('Sort', 0);
         $widgetFrontPageSidebar1->write();
         $widgetSetFrontPageSidebarArea->Widgets()->add($widgetFrontPageSidebar1);
         $widgetFrontPageSidebar2 = new SilvercartShoppingCartWidget();
         $widgetFrontPageSidebar2->setField('Sort', 1);
         $widgetFrontPageSidebar2->write();
         $widgetSetFrontPageSidebarArea->Widgets()->add($widgetFrontPageSidebar2);
         $widgetFrontPageSidebar3 = new SilvercartLoginWidget();
         $widgetFrontPageSidebar3->setField('Sort', 2);
         $widgetFrontPageSidebar3->write();
         $widgetSetFrontPageSidebarArea->Widgets()->add($widgetFrontPageSidebar3);
         // product group page widgets
         $widgetProductGroupPageSidebar1 = new SilvercartProductGroupItemsWidget();
         $widgetProductGroupPageSidebar1->setField('numberOfProductsToShow', 3);
         $widgetProductGroupPageSidebar1->setField('SilvercartProductGroupPageID', $productGroupMarketing->ID);
         $widgetProductGroupPageSidebar1->setField('useSlider', 0);
         $widgetProductGroupPageSidebar1->setField('GroupView', 'list');
         $widgetProductGroupPageSidebar1->setField('isContentView', 0);
         $widgetProductGroupPageSidebar1->setField('buildArrows', 0);
         $widgetProductGroupPageSidebar1->setField('buildNavigation', 1);
         $widgetProductGroupPageSidebar1->setField('buildStartStop', 0);
         $widgetProductGroupPageSidebar1->setField('slideDelay', 4000);
         $widgetProductGroupPageSidebar1->setField('transitionEffect', 'horizontalSlide');
         $widgetProductGroupPageSidebar1->setField('Sort', 0);
         $widgetProductGroupPageSidebar1->write();
         $widgetSetProductGroupPagesSidebarArea->Widgets()->add($widgetProductGroupPageSidebar1);
         $widgetProductGroupPageSidebar2 = new SilvercartShoppingCartWidget();
         $widgetProductGroupPageSidebar2->setField('Sort', 1);
         $widgetProductGroupPageSidebar2->write();
         $widgetSetProductGroupPagesSidebarArea->Widgets()->add($widgetProductGroupPageSidebar2);
         $widgetProductGroupPageSidebar3 = new SilvercartLoginWidget();
         $widgetProductGroupPageSidebar3->setField('Sort', 2);
         $widgetProductGroupPageSidebar3->write();
         $widgetSetProductGroupPagesSidebarArea->Widgets()->add($widgetProductGroupPageSidebar3);
         //self::createTestDataSlidorion($widgetSetFrontPageContentArea);
         return true;
     }
 }
 /**
  * We save the chosen value for the products per page in the customer's
  * configuration object here and redirect to the last view.
  *
  * @param SS_HTTPRequest $data     contains the frameworks form data
  * @param Form           $form     not used
  * @param array          $formData contains the modules form data
  *
  * @return void
  *
  * @author Sebastian Diel <*****@*****.**>,
  *         Sascha Koehler <*****@*****.**>
  * @since 15.11.2014
  */
 public function submitSuccess($data, $form, $formData)
 {
     $backLink = $this->controller->Link();
     $member = SilvercartCustomer::currentUser();
     $product = singleton('SilvercartProduct');
     $sortableFrontendFields = $product->sortableFrontendFields();
     $sortableFrontendFieldValues = array_keys($sortableFrontendFields);
     $sortOrder = $sortableFrontendFieldValues[$data['SortOrder']];
     SilvercartProduct::setDefaultSort($sortOrder);
     if (!$member) {
         $member = SilvercartCustomer::createAnonymousCustomer();
     }
     if ($member) {
         $member->getSilvercartCustomerConfig()->productsPerPage = $data['productsPerPage'];
         $member->getSilvercartCustomerConfig()->write();
     }
     if (isset($formData['backLink'])) {
         $backLink = $formData['backLink'];
     }
     $this->controller->redirect($backLink, 302);
 }
 /**
  * Action to execute a search query
  * 
  * @param SS_HTTPRequest $request    Request to check for product data
  * @param bool           $doRedirect Redirect after setting search settings?
  * 
  * @return void
  *
  * @author Sebastian Diel <*****@*****.**>
  * @since 30.06.2014
  */
 public function doSearch(SS_HTTPRequest $request, $doRedirect = true)
 {
     $postVars = $request->postVars();
     if (!array_key_exists('locale', $postVars) || empty($postVars['locale'])) {
         $postVars['locale'] = Translatable::default_locale();
     }
     Translatable::set_current_locale($postVars['locale']);
     i18n::set_locale($postVars['locale']);
     $quickSearchQuery = trim($postVars['quickSearchQuery']);
     $searchContext = 'SilvercartProduct';
     $searchResultsPage = SilvercartTools::PageByIdentifierCode("SilvercartSearchResultsPage");
     $searchQuery = SilvercartSearchQuery::get_by_query(trim(Convert::raw2sql($quickSearchQuery)));
     $searchQuery->Count++;
     $searchQuery->write();
     SilvercartProduct::setDefaultSort('relevance');
     Session::set("searchQuery", $quickSearchQuery);
     Session::set('searchContext', $searchContext);
     Session::save();
     if ($doRedirect) {
         $this->owner->redirect($searchResultsPage->RelativeLink());
     }
 }
Example #9
0
<?php

/**
 * Copyright 2013 pixeltricks GmbH
 *
 * This file is part of SilverCart.
 *
 * @package Silvercart
 * @subpackage Config
 * @ignore 
 */
// ----------------------------------------------------------------------------
// Define required attributes
// ----------------------------------------------------------------------------
SilvercartProduct::addRequiredAttribute("Price");
// ----------------------------------------------------------------------------
// disable default pages for SiteTree
// ----------------------------------------------------------------------------
SiteTree::set_create_default_pages(false);
// ----------------------------------------------------------------------------
// Add some URL rules for custom controllers
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// Set spam check for forms
// ----------------------------------------------------------------------------
CustomHtmlForm::useSpamCheckFor('SilvercartContactForm');
CustomHtmlForm::useSpamCheckFor('SilvercartRevocationForm');
CustomHtmlForm::$custom_error_box_css_class = 'help-inline';
CustomHtmlForm::$custom_error_box_selection_method = 'append';
CustomHtmlForm::$custom_error_box_sub_selector = ' .controls';
// Require i18n javascript
Example #10
0
 /**
  * Returns the link.
  *
  * @return mixed SiteTree|boolean false
  *
  * @author Sebastian Diel <*****@*****.**>
  * @since 16.06.2014
  */
 public function Link()
 {
     if (is_null($this->link)) {
         $this->link = false;
         if (!empty($this->ProductNumberToReference)) {
             $product = SilvercartProduct::get()->filter('ProductNumberShop', $this->ProductNumberToReference)->first();
             if ($product instanceof SilvercartProduct) {
                 $this->link = $product->Link();
             }
         }
     }
     return $this->link;
 }
 /**
  * Returns the related products.
  * 
  * @return DataObjectSet
  */
 public function getProducts()
 {
     $products = SilvercartProduct::get("SilvercartManufacturerID = " . $this->ID);
     return $products;
 }
 /**
  * Returns a number of bargain products.
  * 
  * @return SS_List
  * 
  * @author Sebastian Diel <*****@*****.**>
  * @since 27.03.2012
  */
 public function Elements()
 {
     if (is_null($this->elements)) {
         if (!$this->numberOfProductsToFetch) {
             $this->numberOfProductsToFetch = SilvercartBargainProductsWidget::$defaults['numberOfProductsToFetch'];
         }
         if (SilvercartConfig::Pricetype() == 'net') {
             $priceField = 'PriceNetAmount';
         } else {
             $priceField = 'PriceGrossAmount';
         }
         switch ($this->fetchMethod) {
             case 'sortOrderAsc':
                 $sort = "\"SilvercartProduct\".\"MSRPriceAmount\" - \"SilvercartProduct\".\"PriceGrossAmount\" ASC";
                 break;
             case 'sortOrderDesc':
                 $sort = "\"SilvercartProduct\".\"MSRPriceAmount\" - \"SilvercartProduct\".\"PriceGrossAmount\" DESC";
                 break;
             case 'random':
             default:
                 $sort = "RAND()";
         }
         $this->listFilters = array();
         if (count(self::$registeredFilterPlugins) > 0) {
             foreach (self::$registeredFilterPlugins as $registeredPlugin) {
                 $pluginFilters = $registeredPlugin->filter();
                 if (is_array($pluginFilters)) {
                     $this->listFilters = array_merge($this->listFilters, $pluginFilters);
                 }
             }
         }
         $filter = sprintf("\"SilvercartProduct\".\"MSRPriceAmount\" IS NOT NULL \n                            AND \"SilvercartProduct\".\"MSRPriceAmount\" > 0\n                            AND \"SilvercartProduct\".\"%s\" < \"SilvercartProduct\".\"MSRPriceAmount\"", $priceField);
         foreach ($this->listFilters as $listFilterIdentifier => $listFilter) {
             $filter .= ' ' . $listFilter;
         }
         $products = SilvercartProduct::getProducts($filter, $sort, null, "0," . $this->numberOfProductsToFetch);
         $this->elements = $products;
         foreach ($this->elements as $element) {
             $element->addCartFormIdentifier = $this->ID . '_' . $element->ID;
         }
     }
     return $this->elements;
 }
 /**
  * Returns the linked SiteTree object.
  *
  * @return mixed SiteTree|boolean false
  *
  * @author Sascha Koehler <*****@*****.**>,
  *         Sebastian Diel <*****@*****.**>
  * @since 16.06.2014
  */
 public function LinkedSite()
 {
     $linkedSite = false;
     if (!empty($this->ProductNumberToReference)) {
         $product = SilvercartProduct::get()->filter('ProductNumberShop', $this->ProductNumberToReference)->first();
         if ($product instanceof SilvercartProduct) {
             $linkedSite = $product;
         }
     }
     if ($linkedSite == false && $this->SiteTreeID > 0) {
         $linkedSite = $this->SiteTree();
     }
     return $linkedSite;
 }
 /**
  * Returns a number of products from the chosen productgroup.
  *
  * @return ArrayList
  *
  * @author Sebastian Diel <*****@*****.**>,
  *         Sascha Koehler <*****@*****.**>
  * @since 15.07.2015
  */
 public function getElementsByProductGroup()
 {
     $cache = false;
     $productGroupPage = Controller::curr();
     $elements = new PaginatedList(new ArrayList());
     if (method_exists($productGroupPage, 'getProductsPerPageSetting')) {
         $elements->pageLength = $productGroupPage->getProductsPerPageSetting();
         $elements->pageStart = $productGroupPage->getSqlOffset();
     }
     $pageEnd = $elements->pageStart + $elements->pageLength;
     $elementIdx = 0;
     $products = new ArrayList();
     if (!$productGroupPage instanceof SilvercartProductGroupPage_Controller || $productGroupPage->getProducts()->count() > 0) {
         return $elements;
     }
     $pageIDsToWorkOn = $productGroupPage->getDescendantIDList();
     if (is_array($pageIDsToWorkOn) && count($pageIDsToWorkOn) > 0) {
         if (SilvercartConfig::DefaultLanguage() != i18n::get_locale()) {
             $translationGroupQuery = 'SELECT "STTG"."TranslationGroupID" FROM "SiteTree_translationgroups" AS "STTG" WHERE "STTG"."OriginalID" IN (' . implode(',', $pageIDsToWorkOn) . ')';
             $translationIDsQuery = 'SELECT "STTG2"."OriginalID" FROM "SiteTree_translationgroups" AS "STTG2" WHERE "STTG2"."TranslationGroupID" IN (' . $translationGroupQuery . ')';
             $mirrored = 'SELECT "SPGMP"."SilvercartProductID" FROM SilvercartProduct_SilvercartProductGroupMirrorPages AS "SPGMP" WHERE "SPGMP"."SilvercartProductGroupPageID" IN (' . implode(',', $pageIDsToWorkOn) . ') OR "SPGMP"."SilvercartProductGroupPageID" IN (' . $translationIDsQuery . ')';
         } else {
             $mirrored = 'SELECT "SPGMP"."SilvercartProductID" FROM SilvercartProduct_SilvercartProductGroupMirrorPages AS "SPGMP" WHERE "SPGMP"."SilvercartProductGroupPageID" IN (' . implode(',', $pageIDsToWorkOn) . ')';
         }
         $products = SilvercartProduct::getProducts('("SilvercartProduct"."SilvercartProductGroupID" IN (' . implode(',', $pageIDsToWorkOn) . ') OR "SilvercartProduct"."ID" IN (' . $mirrored . '))');
     }
     foreach ($products as $product) {
         if ($elementIdx >= $elements->pageStart && $elementIdx < $pageEnd) {
             $product->addCartFormIdentifier = $this->ID . '_' . $product->ID;
             $elements->push($product);
         }
         $elementIdx++;
     }
     $elements->totalSize = $elementIdx;
     $productGroupPage->addTotalNumberOfProducts($elements->totalSize);
     return $elements;
 }