/**
  * Returns a ArrayList of attributed images. If there are no images
  * attributed the method checks if there's a standard no-image
  * visualitation defined in SilvercartConfig and returns the defined image
  * as ArrayList. As last resort boolean false is returned.
  *
  * @param string $filter An optional sql filter statement
  *
  * @return SS_List
  *
  * @author Sascha Koehler <*****@*****.**>,
  *         Sebastian Diel <*****@*****.**>,
  *         Ramon Kupper <*****@*****.**>
  * @since 11.08.2014
  */
 public function getSilvercartImages($filter = '')
 {
     if (!array_key_exists($filter, $this->images)) {
         $images = false;
         $this->extend('overwriteSilvercartImages', $images);
         if ($images == false) {
             $images = $this->SilvercartImages($filter);
             $this->extend('updateGetSilvercartImages', $images);
             if ($images->count() > 0) {
                 $existingImages = new ArrayList();
                 foreach ($images as $image) {
                     if (!file_exists($image->Image()->getFullPath())) {
                         $noImageObj = SilvercartConfig::getNoImage();
                         if ($noImageObj) {
                             $image = new SilvercartImage();
                             $image->ImageID = $noImageObj->ID;
                             $image->SilvercartProductID = $this->ID;
                         }
                     }
                     $existingImages->push($image);
                 }
                 $images = $existingImages;
             }
         }
         if (!$images instanceof ArrayList || $images->count() == 0) {
             $noImageObj = SilvercartConfig::getNoImage();
             if ($noImageObj->exists()) {
                 $image = SilvercartImage::get()->filter('ImageID', $noImageObj->ID)->first();
                 if (!$image instanceof SilvercartImage || !$image->exists()) {
                     $image = new SilvercartImage();
                     $image->ImageID = $noImageObj->ID;
                     $image->write();
                 }
                 $images = new ArrayList();
                 $images->push($image);
             }
         }
         $this->images[$filter] = $images;
     }
     return $this->images[$filter];
 }
 /**
  * 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;
     }
 }
 /**
  * Adds a new image to the given product.
  * 
  * @param SilvercartProduct $product           Product to add image to
  * @param string            $filename          Filename
  * @param string            $description       Description
  * @param int               $consecutiveNumber Consecutive number
  */
 protected function addNewImage(SilvercartProduct $product, $filename, $description, $consecutiveNumber)
 {
     $fileEnding = strrev(substr(strrev($filename), 0, strpos(strrev($filename), '.')));
     $nameFilter = FileNameFilter::create();
     $targetFilename = $product->ProductNumberShop . '-' . $nameFilter->filter($product->Title) . '-' . $consecutiveNumber . '.' . $fileEnding;
     $originalFile = self::get_absolute_upload_folder() . '/' . $filename;
     $targetFile = self::get_absolute_product_image_folder() . '/' . $targetFilename;
     $parentFolder = Folder::find_or_make('Uploads/product-images');
     rename($originalFile, $targetFile);
     $image = new Image();
     $image->Name = basename($targetFilename);
     $image->ParentID = $parentFolder->ID;
     $image->write();
     $silvercartImage = new SilvercartImage();
     $silvercartImage->ImageID = $image->ID;
     $silvercartImage->Title = $description;
     $silvercartImage->write();
     $product->SilvercartImages()->add($silvercartImage);
 }
 /**
  * Creates the upload folder for payment images if it doesn't exist.
  *
  * @param array  $paymentLogos      The payment logos as associative array:
  *                                  ['LogoName' => 'PATH_TO_FILE', ....]
  * @param string $paymentModuleName The name of the payment module
  *
  * @return void
  *
  * @author Sebastian Diel <*****@*****.**>,
  *         Sascha Koehler <*****@*****.**>
  * @since 16.06.2014
  */
 public function createLogoImageObjects($paymentLogos, $paymentModuleName)
 {
     //make sure that the folder "Uploads" exists
     Folder::find_or_make('Uploads');
     $paymentModule = SilvercartPaymentMethod::get()->filter(array("ClassName" => $paymentModuleName))->sort(array("ID" => "ASC"))->first();
     if ($paymentModule) {
         if (count($this->getPossiblePaymentChannels()) > 0) {
             // Multiple payment channels
             foreach ($paymentLogos as $paymentChannel => $logos) {
                 $paymentChannelMethod = DataObject::get_one($paymentModuleName, sprintf("\"PaymentChannel\"='%s'", $paymentChannel), true, $paymentModuleName . ".ID");
                 if ($paymentChannelMethod) {
                     if (!$paymentChannelMethod->PaymentLogos()->exists()) {
                         foreach ($logos as $title => $logo) {
                             $paymentLogo = new SilvercartImage();
                             $paymentLogo->Title = $title;
                             $storedLogo = Image::get()->filter('Name', basename($logo))->first();
                             if ($storedLogo) {
                                 $paymentLogo->ImageID = $storedLogo->ID;
                             } else {
                                 file_put_contents(Director::baseFolder() . '/' . $this->uploadsFolder->Filename . basename($logo), file_get_contents(Director::baseFolder() . $logo));
                                 $image = new Image();
                                 $image->setFilename($this->uploadsFolder->Filename . basename($logo));
                                 $image->setName(basename($logo));
                                 $image->Title = basename($logo, '.png');
                                 $image->ParentID = $this->uploadsFolder->ID;
                                 $image->write();
                                 $paymentLogo->ImageID = $image->ID;
                             }
                             $paymentLogo->write();
                             $paymentChannelMethod->PaymentLogos()->add($paymentLogo);
                         }
                     }
                 }
             }
         } else {
             // Single payment channels
             foreach ($paymentLogos as $title => $logo) {
                 if (!$paymentModule->PaymentLogos()->exists()) {
                     $paymentLogo = new SilvercartImage();
                     $paymentLogo->Title = $title;
                     $storedLogo = Image::get()->filter('Name', basename($logo))->first();
                     if ($storedLogo) {
                         $paymentLogo->ImageID = $storedLogo->ID;
                     } else {
                         file_put_contents(Director::baseFolder() . '/' . $this->uploadsFolder->Filename . basename($logo), file_get_contents(Director::baseFolder() . $logo));
                         $image = new Image();
                         $image->setFilename($this->uploadsFolder->Filename . basename($logo));
                         $image->setName(basename($logo));
                         $image->Title = basename($logo, '.png');
                         $image->ParentID = $this->uploadsFolder->ID;
                         $image->write();
                         $paymentLogo->ImageID = $image->ID;
                     }
                     $paymentLogo->write();
                     $paymentModule->PaymentLogos()->add($paymentLogo);
                 }
             }
         }
     }
 }