Exemplo n.º 1
0
 /**
  * Export the products by the Google Product Atom Export
  * @author Shine Software
  * @return xml 
  */
 public function googleproductsAction()
 {
     // Calling Google Product Extension
     Zend_Feed_Writer::addPrefixPath('Shineisp_Feed_Writer_Extension_', 'Shineisp/Feed/Writer/Extension/');
     Zend_Feed_Writer::registerExtension('Google');
     $isp = Shineisp_Registry::get('ISP');
     $feed = new Zend_Feed_Writer_Feed();
     $feed->setTitle($isp->company);
     $feed->setLink($isp->website);
     $feed->setFeedLink($isp->website . '/atom/products', 'atom');
     $feed->addAuthor(array('name' => $isp->manager, 'email' => $isp->email, 'uri' => $isp->website));
     $feed->setDateModified(time());
     $feed->setGenerator("ShineISP Atom Extension");
     $products = Products::getAllRss();
     // 		print_r($products);
     // 		die;
     foreach ($products as $product) {
         // Get the google categories
         $categories = ProductsCategories::getGoogleCategories($product['categories']);
         $cattype = Products::get_text_categories($product['categories']);
         // Create the product entries
         $entry = $feed->createEntry();
         $entry->setTitle($product['ProductsData'][0]['name']);
         $entry->setProductType(Products::get_text_categories($product['categories']));
         $entry->setBrand($isp->company);
         $entry->setAvailability(true);
         $entry->setLink($isp->website . "/" . $product['uri'] . ".html");
         // Custom Attributes Google Product Extension
         if (!empty($product['ProductsMedia'][0]['path'])) {
             $entry->setImageLink($isp->website . str_replace(" ", "%20", $product['ProductsMedia'][0]['path']));
         }
         if (!empty($product['uri'])) {
             $entry->setProductId($product['uri']);
         }
         if (!empty($categories[0]['googlecategs'])) {
             $entry->setCategory($categories[0]['googlecategs']);
         }
         $price = Products::getPriceSuggested($product['product_id'], true);
         $entry->setPrice($price);
         $entry->setCondition('new');
         $entry->setDateModified(time());
         $entry->setDescription(strip_tags($product['ProductsData'][0]['shortdescription']));
         $feed->addEntry($entry);
     }
     $feed = $feed->export('atom');
     // Feed Fixing for google products
     $feed = $this->googlefixes($feed);
     Shineisp_Commons_Utilities::writefile($feed, "documents", "googleproducts.xml");
     die($feed);
 }
Exemplo n.º 2
0
 /**
  * Update the database item translation using the poedit!
  * This method creates a temporary file that helps you to parse the 
  * database table common contents.  
  */
 public function updatetranslationAction()
 {
     $content = "<?php\n ";
     $content .= "# WARNING: This file has been created only for the POEDIT software.\n";
     $content .= "#          You can delete it, if you don't use it! \n\n";
     // Setting Parameters
     $data = SettingsParameters::getAllInfo();
     foreach ($data as $item) {
         $content .= "echo _('" . $item['name'] . "');\n";
         $content .= "echo _('" . $item['description'] . "');\n";
     }
     // Server Types
     $data = Servers_Types::getList();
     foreach ($data as $id => $item) {
         $content .= "echo _('" . $item . "');\n";
     }
     // Contact types
     $data = ContactsTypes::getList();
     foreach ($data as $id => $item) {
         $content .= "echo _('" . $item . "');\n";
     }
     // Legal form
     $data = Legalforms::getList();
     foreach ($data as $id => $item) {
         $content .= "echo _('" . $item . "');\n";
     }
     // Get the default navigation items
     $config = new Zend_Config_Xml(APPLICATION_PATH . '/modules/default/navigation.xml', 'nav');
     $navigation = new Zend_Navigation($config);
     // Iterate recursively using RecursiveIteratorIterator
     $pages = new RecursiveIteratorIterator($navigation, RecursiveIteratorIterator::SELF_FIRST);
     foreach ($pages as $page) {
         $label = (string) $page->label;
         $content .= "echo _('{$label}');\n";
     }
     // Get the administration navigation items
     $config = new Zend_Config_Xml(APPLICATION_PATH . '/modules/admin/navigation.xml', 'nav');
     $navigation = new Zend_Navigation($config);
     // Iterate recursively using RecursiveIteratorIterator
     $pages = new RecursiveIteratorIterator($navigation, RecursiveIteratorIterator::SELF_FIRST);
     foreach ($pages as $page) {
         $label = $page->getLabel();
         $content .= "echo _('{$label}');\n";
     }
     $content .= "?>";
     Shineisp_Commons_Utilities::writefile($content, "tmp", "translations.php");
     die('Ok! Now update the default.po file by the poedit software');
 }