Version Notes
-- ToTheGame API URL changed. ToTheGame changed old API url to new url that's why old version was not working. We changed it.
-- Some of new feature added
-- Some of bug are fix
Download this release
Release Info
Developer | CyberNetikz |
Extension | Cybernetikz_ToTheGame |
Version | 0.2.0 |
Comparing to | |
See all releases |
Code changes from version 0.1.0 to 0.2.0
app/code/local/Cybernetikz/ToTheGame/controllers/Adminhtml/{ToTheGameController.php → TothegameController.php}
RENAMED
@@ -6,20 +6,12 @@
|
|
6 |
* Website : http://www.cybernetikz.com
|
7 |
*/
|
8 |
|
9 |
-
class
|
10 |
{
|
11 |
|
12 |
protected $_startTime;
|
13 |
protected $gameCount = 0;
|
14 |
|
15 |
-
/*
|
16 |
-
Diclar destruct
|
17 |
-
*/
|
18 |
-
/*function __destruct(){
|
19 |
-
$this->_PhpShutdown();
|
20 |
-
}*/
|
21 |
-
|
22 |
-
|
23 |
/**
|
24 |
* Init actions
|
25 |
*
|
@@ -91,11 +83,9 @@ class Cybernetikz_ToTheGame_Adminhtml_ToTheGameController extends Mage_Adminhtml
|
|
91 |
protected function importGame($gameId) {
|
92 |
|
93 |
$SUBSCRIBER_ID = Mage::helper('cybernetikz_tothegame')->getSubscriberId(); // Subscriber Id
|
94 |
-
$IMPORT_USE_CACHE = 1;
|
95 |
-
$IMPORT_CACHE_TTL = (Mage::helper('cybernetikz_tothegame')->getImportCacheTTL()*3600); // # of seconds when the cache is set to expire
|
96 |
$gameProducttId = "";
|
97 |
|
98 |
-
$gameUrl = 'http://
|
99 |
|
100 |
$xml = new DOMDocument(); // Create new DOM object
|
101 |
|
@@ -109,26 +99,10 @@ class Cybernetikz_ToTheGame_Adminhtml_ToTheGameController extends Mage_Adminhtml
|
|
109 |
|
110 |
try {
|
111 |
|
112 |
-
//
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
echo "<span style='color:red;'>--Error: Failed to create folders...</span><br>";
|
117 |
-
return;
|
118 |
-
}
|
119 |
-
}
|
120 |
-
|
121 |
-
$gamefeed_file_path = $upload_gamefeed. DS .$gameId.".xml";
|
122 |
-
|
123 |
-
if (file_exists($gamefeed_file_path) && $IMPORT_USE_CACHE && time() - filectime($gamefeed_file_path) < $IMPORT_CACHE_TTL) {
|
124 |
-
echo "-- Loading game data from cache<br>";
|
125 |
-
$xml->load($gamefeed_file_path);
|
126 |
-
} else {
|
127 |
-
echo "-- Loading game data from publisher<br>";
|
128 |
-
$xml->load($gameUrl);
|
129 |
-
// cache the file
|
130 |
-
$xml->save($gamefeed_file_path);
|
131 |
-
}
|
132 |
|
133 |
// Check Product Availability
|
134 |
if(!$this->_getElementValue($xml, 'OfficialTitle')){
|
@@ -453,22 +427,29 @@ class Cybernetikz_ToTheGame_Adminhtml_ToTheGameController extends Mage_Adminhtml
|
|
453 |
|
454 |
// Assign Packsthot Image as Product Images
|
455 |
foreach($_productData['Packshots'] as $type => $PackshotImage){
|
456 |
-
|
457 |
-
$
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
465 |
}
|
466 |
}
|
467 |
|
468 |
// Assign Screenshot Image as Product Images
|
469 |
foreach($_productData['Screenshots'] as $type => $screenshotImages){
|
470 |
$screenshotImage = $screenshotImages['UrlLarge'];
|
471 |
-
$importDir = Mage::getBaseDir('media') . DS . 'import'
|
472 |
$image_name = $gameId."-screenshot"."-".$type.".jpg";
|
473 |
$screenshotImageUrl = $importDir. DS .$image_name;
|
474 |
// Copy Image from totheGame server to local server
|
@@ -476,6 +457,7 @@ class Cybernetikz_ToTheGame_Adminhtml_ToTheGameController extends Mage_Adminhtml
|
|
476 |
echo "-- upl. ", $screenshotImage, " to Local Server<br>";
|
477 |
// Add three image sizes to media gallery
|
478 |
$_product->addImageToMediaGallery($screenshotImageUrl, false, false, false); // Assigning screenshot image to media gallery
|
|
|
479 |
}
|
480 |
}
|
481 |
|
@@ -536,10 +518,7 @@ class Cybernetikz_ToTheGame_Adminhtml_ToTheGameController extends Mage_Adminhtml
|
|
536 |
$stores=Mage::getModel('core/store')->getCollection()->load()->getAllIds();
|
537 |
foreach($stores as $estoreid){
|
538 |
$storeids[]=$estoreid;
|
539 |
-
}
|
540 |
-
//print_r($websiteids);
|
541 |
-
//print_r($storeids);
|
542 |
-
//exit;
|
543 |
|
544 |
$product = new Mage_Catalog_Model_Product();
|
545 |
|
@@ -591,22 +570,29 @@ class Cybernetikz_ToTheGame_Adminhtml_ToTheGameController extends Mage_Adminhtml
|
|
591 |
|
592 |
// Assign Packsthot Image as Product Images
|
593 |
foreach($_productData['Packshots'] as $type => $PackshotImage){
|
594 |
-
|
595 |
-
$
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
603 |
}
|
604 |
}
|
605 |
|
606 |
// Assign Screenshot Image as Product Images
|
607 |
foreach($_productData['Screenshots'] as $type => $screenshotImages){
|
608 |
$screenshotImage = $screenshotImages['UrlLarge'];
|
609 |
-
$importDir = Mage::getBaseDir('media') . DS . 'import'
|
610 |
$image_name = $gameId."-screenshot"."-".$type.".jpg";
|
611 |
$screenshotImageUrl = $importDir. DS .$image_name;
|
612 |
// Copy Image from totheGame server to local server
|
@@ -614,11 +600,11 @@ class Cybernetikz_ToTheGame_Adminhtml_ToTheGameController extends Mage_Adminhtml
|
|
614 |
echo "-- upl. ", $screenshotImage, " to Local Server<br>";
|
615 |
// Add three image sizes to media gallery
|
616 |
$product->addImageToMediaGallery($screenshotImageUrl, false, false, false); // Assigning screenshot image to media gallery
|
|
|
|
|
617 |
}
|
618 |
}
|
619 |
|
620 |
-
//print_r($product->getData()); exit;
|
621 |
-
|
622 |
try {
|
623 |
$product->save();
|
624 |
echo "-- Product success added<br>";
|
@@ -628,12 +614,6 @@ class Cybernetikz_ToTheGame_Adminhtml_ToTheGameController extends Mage_Adminhtml
|
|
628 |
return;
|
629 |
}
|
630 |
}
|
631 |
-
|
632 |
-
/*$index_arr=array(1,4);
|
633 |
-
foreach($index_arr as $index){
|
634 |
-
$process = Mage::getModel('index/process')->load($index);
|
635 |
-
$process->reindexAll();
|
636 |
-
}*/
|
637 |
|
638 |
} catch (Exception $e) {
|
639 |
echo '--! exception: ', $e->getMessage(), "<br>";
|
6 |
* Website : http://www.cybernetikz.com
|
7 |
*/
|
8 |
|
9 |
+
class Cybernetikz_ToTheGame_Adminhtml_TothegameController extends Mage_Adminhtml_Controller_Action
|
10 |
{
|
11 |
|
12 |
protected $_startTime;
|
13 |
protected $gameCount = 0;
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
/**
|
16 |
* Init actions
|
17 |
*
|
83 |
protected function importGame($gameId) {
|
84 |
|
85 |
$SUBSCRIBER_ID = Mage::helper('cybernetikz_tothegame')->getSubscriberId(); // Subscriber Id
|
|
|
|
|
86 |
$gameProducttId = "";
|
87 |
|
88 |
+
$gameUrl = 'http://export2.tothegame.com/gamefeeder/v3/gamelookup.aspx?subscriberid='.$SUBSCRIBER_ID.'&gameid='.$gameId;
|
89 |
|
90 |
$xml = new DOMDocument(); // Create new DOM object
|
91 |
|
99 |
|
100 |
try {
|
101 |
|
102 |
+
// Load XML Feed
|
103 |
+
echo "-- Loading game data from publisher<br>";
|
104 |
+
$xml->load($gameUrl);
|
105 |
+
$xml->saveXML();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
|
107 |
// Check Product Availability
|
108 |
if(!$this->_getElementValue($xml, 'OfficialTitle')){
|
427 |
|
428 |
// Assign Packsthot Image as Product Images
|
429 |
foreach($_productData['Packshots'] as $type => $PackshotImage){
|
430 |
+
// Thumb image skip
|
431 |
+
if($type == "UrlThumb"){
|
432 |
+
continue;
|
433 |
+
}else{
|
434 |
+
$importDir = Mage::getBaseDir('media') . DS . 'import';
|
435 |
+
$image_name = $gameId."-packshot"."-".$type.".jpg";
|
436 |
+
$packImageUrl = $importDir. DS .$image_name;
|
437 |
+
// Copy Image from totheGame server to local server
|
438 |
+
if(copy($PackshotImage, $packImageUrl)){
|
439 |
+
echo "-- upl. ", $PackshotImage, " to Local Server<br>";
|
440 |
+
// Add three image sizes to media gallery
|
441 |
+
$_product->addImageToMediaGallery($packImageUrl, array('image','thumbnail','small_image'), false, false); // Assigning packshot image, thumb and small image to media gallery
|
442 |
+
break;
|
443 |
+
|
444 |
+
unlink($packImageUrl); // Remove Image after add to product image
|
445 |
+
}
|
446 |
}
|
447 |
}
|
448 |
|
449 |
// Assign Screenshot Image as Product Images
|
450 |
foreach($_productData['Screenshots'] as $type => $screenshotImages){
|
451 |
$screenshotImage = $screenshotImages['UrlLarge'];
|
452 |
+
$importDir = Mage::getBaseDir('media') . DS . 'import';
|
453 |
$image_name = $gameId."-screenshot"."-".$type.".jpg";
|
454 |
$screenshotImageUrl = $importDir. DS .$image_name;
|
455 |
// Copy Image from totheGame server to local server
|
457 |
echo "-- upl. ", $screenshotImage, " to Local Server<br>";
|
458 |
// Add three image sizes to media gallery
|
459 |
$_product->addImageToMediaGallery($screenshotImageUrl, false, false, false); // Assigning screenshot image to media gallery
|
460 |
+
unlink($screenshotImageUrl); // Remove Image after add to product image
|
461 |
}
|
462 |
}
|
463 |
|
518 |
$stores=Mage::getModel('core/store')->getCollection()->load()->getAllIds();
|
519 |
foreach($stores as $estoreid){
|
520 |
$storeids[]=$estoreid;
|
521 |
+
}
|
|
|
|
|
|
|
522 |
|
523 |
$product = new Mage_Catalog_Model_Product();
|
524 |
|
570 |
|
571 |
// Assign Packsthot Image as Product Images
|
572 |
foreach($_productData['Packshots'] as $type => $PackshotImage){
|
573 |
+
// Thumb image skip
|
574 |
+
if($type == "UrlThumb"){
|
575 |
+
continue;
|
576 |
+
}else{
|
577 |
+
$importDir = Mage::getBaseDir('media') . DS . 'import';
|
578 |
+
$image_name = $gameId."-packshot"."-".$type.".jpg";
|
579 |
+
$packImageUrl = $importDir. DS .$image_name;
|
580 |
+
// Copy Image from totheGame server to local server
|
581 |
+
if(copy($PackshotImage, $packImageUrl)){
|
582 |
+
echo "-- upl. ", $PackshotImage, " to Local Server<br>";
|
583 |
+
// Add three image sizes to media gallery
|
584 |
+
$product->addImageToMediaGallery($packImageUrl, array('image','thumbnail','small_image'), false, false); // Assigning packshot image, thumb and small image to media gallery
|
585 |
+
break;
|
586 |
+
|
587 |
+
unlink($packImageUrl); // Remove Image after add to product image
|
588 |
+
}
|
589 |
}
|
590 |
}
|
591 |
|
592 |
// Assign Screenshot Image as Product Images
|
593 |
foreach($_productData['Screenshots'] as $type => $screenshotImages){
|
594 |
$screenshotImage = $screenshotImages['UrlLarge'];
|
595 |
+
$importDir = Mage::getBaseDir('media') . DS . 'import';
|
596 |
$image_name = $gameId."-screenshot"."-".$type.".jpg";
|
597 |
$screenshotImageUrl = $importDir. DS .$image_name;
|
598 |
// Copy Image from totheGame server to local server
|
600 |
echo "-- upl. ", $screenshotImage, " to Local Server<br>";
|
601 |
// Add three image sizes to media gallery
|
602 |
$product->addImageToMediaGallery($screenshotImageUrl, false, false, false); // Assigning screenshot image to media gallery
|
603 |
+
|
604 |
+
unlink($screenshotImageUrl); // Remove Image after add to product image
|
605 |
}
|
606 |
}
|
607 |
|
|
|
|
|
608 |
try {
|
609 |
$product->save();
|
610 |
echo "-- Product success added<br>";
|
614 |
return;
|
615 |
}
|
616 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
617 |
|
618 |
} catch (Exception $e) {
|
619 |
echo '--! exception: ', $e->getMessage(), "<br>";
|
app/code/local/Cybernetikz/ToTheGame/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Cybernetikz_ToTheGame>
|
5 |
-
<version>0.
|
6 |
</Cybernetikz_ToTheGame>
|
7 |
</modules>
|
8 |
<global>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Cybernetikz_ToTheGame>
|
5 |
+
<version>0.2.0</version>
|
6 |
</Cybernetikz_ToTheGame>
|
7 |
</modules>
|
8 |
<global>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Cybernetikz_ToTheGame</name>
|
4 |
-
<version>0.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL 3.0)</license>
|
7 |
<channel>community</channel>
|
@@ -9,11 +9,13 @@
|
|
9 |
<summary>Automatically import (add/update) product information from ToTheGame game feed for your store.</summary>
|
10 |
<description>- Allow You to Import Product from ToTheGame Feeder into Magento
|
11 |
- Allow You to Show All Products Info into Your Product Detail Page like Title, Descriptions, Platform, Boxshots, Screenshots, Videos, Genre, Publisher, Release Date, Developers etc</description>
|
12 |
-
<notes
|
|
|
|
|
13 |
<authors><author><name>CyberNetikz</name><user>CyberNetikz</user><email>sales@cybernetikz.com</email></author></authors>
|
14 |
-
<date>2015-
|
15 |
-
<time>
|
16 |
-
<contents><target name="mageetc"><dir name="modules"><file name="Cybernetikz_ToTheGame.xml" hash="56a3597fb67967ea0407b087d251c4e3"/></dir></target><target name="magelocal"><dir name="Cybernetikz"><dir name="ToTheGame"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Hint.php" hash="595da4f66a0fe867d47c9cdd71015823"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="f86910ee11b8e1330cb9ea157ddacf76"/></dir><dir name="Model"><dir name="Resource"><dir name="Mysql4"><file name="Setup.php" hash="a30938317dace0f4c48832dfb06773d0"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="
|
17 |
<compatible/>
|
18 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
19 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Cybernetikz_ToTheGame</name>
|
4 |
+
<version>0.2.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL 3.0)</license>
|
7 |
<channel>community</channel>
|
9 |
<summary>Automatically import (add/update) product information from ToTheGame game feed for your store.</summary>
|
10 |
<description>- Allow You to Import Product from ToTheGame Feeder into Magento
|
11 |
- Allow You to Show All Products Info into Your Product Detail Page like Title, Descriptions, Platform, Boxshots, Screenshots, Videos, Genre, Publisher, Release Date, Developers etc</description>
|
12 |
+
<notes>-- ToTheGame API URL changed. ToTheGame changed old API url to new url that's why old version was not working. We changed it.
|
13 |
+
-- Some of new feature added
|
14 |
+
-- Some of bug are fix</notes>
|
15 |
<authors><author><name>CyberNetikz</name><user>CyberNetikz</user><email>sales@cybernetikz.com</email></author></authors>
|
16 |
+
<date>2015-11-19</date>
|
17 |
+
<time>09:54:59</time>
|
18 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Cybernetikz_ToTheGame.xml" hash="56a3597fb67967ea0407b087d251c4e3"/></dir></target><target name="magelocal"><dir name="Cybernetikz"><dir name="ToTheGame"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Hint.php" hash="595da4f66a0fe867d47c9cdd71015823"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="f86910ee11b8e1330cb9ea157ddacf76"/></dir><dir name="Model"><dir name="Resource"><dir name="Mysql4"><file name="Setup.php" hash="a30938317dace0f4c48832dfb06773d0"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="TothegameController.php" hash="5f5f770e85f81cb670915f5d4249acd9"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="0667d87d1bcccac7d5f9f1cd3719432c"/><file name="config.xml" hash="a1c5ee829bfe7e3e6ae9fa6f00783d6e"/><file name="system.xml" hash="180d791b1f52a8bb78a901bb13499aed"/></dir><dir name="sql"><dir name="tothegame_setup"><file name="mysql4-install-0.1.0.php" hash="57ee1befe5d68afc4e7faa50487b8333"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="cybernetikz_tothegame.xml" hash="aa961d53d71288758b51cee8d3d155d3"/></dir><dir name="template"><dir name="cybernetikz"><dir name="tothegame"><file name="gameimport.phtml" hash="005fdd07c423b199f5a3661384fc8124"/><dir name="system"><dir name="config"><dir name="fieldset"><file name="hint.phtml" hash="77c083d7b58e29bd9f6a4b432a9d5ce1"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="cybernetikz"><dir name="tothegame"><dir name="images"><file name="indicator.gif" hash="86b1ac6d1c485d54efa3a53643e91ceb"/></dir><dir name="js"><file name="jquery.js" hash="a9331828c517ac5d97f93b3cfdbcc9bc"/></dir></dir></dir></dir></dir></dir></target></contents>
|
19 |
<compatible/>
|
20 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
21 |
</package>
|