Version Notes
Please full-backup your Magento (files and database before installing this extension.
Download this release
Release Info
Developer | FS eCommerce GmbH |
Extension | 3e19b9f7d5f059757aaf1fe40c97fc9a |
Version | 0.0.1 |
Comparing to | |
See all releases |
Version 0.0.1
- app/code/local/Fsecommerce/Convertizer/Block/Adminhtml/Feed.php +60 -0
- app/code/local/Fsecommerce/Convertizer/Helper/Data.php +60 -0
- app/code/local/Fsecommerce/Convertizer/Model/Adminhtml/Attribute.php +26 -0
- app/code/local/Fsecommerce/Convertizer/Model/Adminhtml/Category.php +32 -0
- app/code/local/Fsecommerce/Convertizer/Model/Adminhtml/Producttype.php +22 -0
- app/code/local/Fsecommerce/Convertizer/Model/Adminhtml/Store.php +15 -0
- app/code/local/Fsecommerce/Convertizer/Model/Feed.php +521 -0
- app/code/local/Fsecommerce/Convertizer/controllers/AddController.php +77 -0
- app/code/local/Fsecommerce/Convertizer/controllers/Adminhtml/FeedController.php +510 -0
- app/code/local/Fsecommerce/Convertizer/etc/config.xml +89 -0
- app/code/local/Fsecommerce/Convertizer/etc/system.xml +257 -0
- app/design/adminhtml/default/default/template/convertizer/feed.phtml +22 -0
- app/design/frontend/base/default/layout/fsecommerce_convertizer.xml +9 -0
- app/design/frontend/base/default/template/fse/convertizer/convertizer_tracking.phtml +28 -0
- app/etc/modules/Fsecommerce_Convertizer.xml +8 -0
- media/convertizer/readme.txt +1 -0
- package.xml +25 -0
app/code/local/Fsecommerce/Convertizer/Block/Adminhtml/Feed.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Fsecommerce_Convertizer_Block_Adminhtml_Feed extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
/*
|
6 |
+
* Set template
|
7 |
+
*/
|
8 |
+
protected function _construct()
|
9 |
+
{
|
10 |
+
parent::_construct();
|
11 |
+
$this->setTemplate('convertizer/feed.phtml');
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Return element html
|
16 |
+
*
|
17 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
18 |
+
* @return string
|
19 |
+
*/
|
20 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
21 |
+
{
|
22 |
+
return $this->_toHtml();
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Return ajax url for button
|
27 |
+
*
|
28 |
+
* @return string
|
29 |
+
*/
|
30 |
+
public function generateFeed()
|
31 |
+
{
|
32 |
+
return Mage::helper('adminhtml')->getUrl('convertizer/adminhtml_feed/generate');
|
33 |
+
}
|
34 |
+
|
35 |
+
public function getFeedData(){
|
36 |
+
return Mage::helper('adminhtml')->getUrl('convertizer/adminhtml_feed/generate');
|
37 |
+
}
|
38 |
+
|
39 |
+
public function showResult(){
|
40 |
+
$result = "Success";
|
41 |
+
return $result;
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Generate button html
|
46 |
+
*
|
47 |
+
* @return string
|
48 |
+
*/
|
49 |
+
public function getButtonHtml()
|
50 |
+
{
|
51 |
+
$button = $this->getLayout()->createBlock('adminhtml/widget_button')
|
52 |
+
->setData(array(
|
53 |
+
'id' => 'convertizer_button',
|
54 |
+
'label' => $this->helper('adminhtml')->__('Generate'),
|
55 |
+
'onclick' => 'javascript:generateconvertizerfeed(); return false;'
|
56 |
+
));
|
57 |
+
|
58 |
+
return $button->toHtml();
|
59 |
+
}
|
60 |
+
}
|
app/code/local/Fsecommerce/Convertizer/Helper/Data.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Fsecommerce_Convertizer_Helper_Data extends Mage_Core_Helper_Abstract{
|
4 |
+
|
5 |
+
const XML_PATH_ENABLED = 'fsecommerce_convertizer/tracking/enabled';
|
6 |
+
const XML_PATH_TRACKINGCODE = 'fsecommerce_convertizer/tracking/track';
|
7 |
+
const XML_PATH_SHIPPINGGOOGLE = 'fsecommerce_convertizer/feed/shipping_google';
|
8 |
+
const XML_PATH_SHIPPINGGENERAL = 'fsecommerce_convertizer/feed/shipping_general';
|
9 |
+
|
10 |
+
const XML_PATH_CUSTOMATTR01 = 'fsecommerce_convertizer/feed/custom_attr_01';
|
11 |
+
const XML_PATH_CUSTOMATTR02 = 'fsecommerce_convertizer/feed/custom_attr_02';
|
12 |
+
const XML_PATH_CUSTOMATTR03 = 'fsecommerce_convertizer/feed/custom_attr_03';
|
13 |
+
const XML_PATH_CUSTOMATTR04 = 'fsecommerce_convertizer/feed/custom_attr_04';
|
14 |
+
const XML_PATH_CUSTOMATTR05 = 'fsecommerce_convertizer/feed/custom_attr_05';
|
15 |
+
|
16 |
+
const XML_PATH_ADDITIONALATTR01 = 'fsecommerce_convertizer/feed/additional_attr_01';
|
17 |
+
const XML_PATH_ADDITIONALATTR02 = 'fsecommerce_convertizer/feed/additional_attr_02';
|
18 |
+
const XML_PATH_ADDITIONALATTR03 = 'fsecommerce_convertizer/feed/additional_attr_03';
|
19 |
+
const XML_PATH_ADDITIONALATTR04 = 'fsecommerce_convertizer/feed/additional_attr_04';
|
20 |
+
const XML_PATH_ADDITIONALATTR05 = 'fsecommerce_convertizer/feed/additional_attr_05';
|
21 |
+
|
22 |
+
const XML_PATH_PRODUCTCATEGORY = 'fsecommerce_convertizer/feed/product_category';
|
23 |
+
|
24 |
+
const XML_PATH_KEYWORDS = 'fsecommerce_convertizer/feed/keywords';
|
25 |
+
|
26 |
+
const XML_PATH_CATEGORY_ENABLED = 'fsecommerce_convertizer/feed/category_filter_enabled';
|
27 |
+
const XML_PATH_CATEGORY = 'fsecommerce_convertizer/feed/category_filter';
|
28 |
+
const XML_PATH_STORE = 'fsecommerce_convertizer/cron/default_store';
|
29 |
+
const XML_PATH_CRON_ENABLED = 'fsecommerce_convertizer/cron/cron_enabled';
|
30 |
+
|
31 |
+
const XML_PATH_EXCLUDE_OPTIONS = 'fsecommerce_convertizer/feed/exclude_options';
|
32 |
+
|
33 |
+
public function isEnabled(){return Mage::getStoreConfig( self::XML_PATH_ENABLED );}
|
34 |
+
public function getTrackingCode(){return Mage::getStoreConfig( self::XML_PATH_TRACKINGCODE );}
|
35 |
+
|
36 |
+
public function getCustomAttribute01(){return Mage::getStoreConfig( self::XML_PATH_CUSTOMATTR01 );}
|
37 |
+
public function getCustomAttribute02(){return Mage::getStoreConfig( self::XML_PATH_CUSTOMATTR02 );}
|
38 |
+
public function getCustomAttribute03(){return Mage::getStoreConfig( self::XML_PATH_CUSTOMATTR03 );}
|
39 |
+
public function getCustomAttribute04(){return Mage::getStoreConfig( self::XML_PATH_CUSTOMATTR04 );}
|
40 |
+
public function getCustomAttribute05(){return Mage::getStoreConfig( self::XML_PATH_CUSTOMATTR05 );}
|
41 |
+
|
42 |
+
public function getKeywords(){return Mage::getStoreConfig( self::XML_PATH_KEYWORDS );}
|
43 |
+
|
44 |
+
public function getAdditionalAttribute01(){return Mage::getStoreConfig( self::XML_PATH_ADDITIONALATTR01 );}
|
45 |
+
public function getAdditionalAttribute02(){return Mage::getStoreConfig( self::XML_PATH_ADDITIONALATTR02 );}
|
46 |
+
public function getAdditionalAttribute03(){return Mage::getStoreConfig( self::XML_PATH_ADDITIONALATTR03 );}
|
47 |
+
public function getAdditionalAttribute04(){return Mage::getStoreConfig( self::XML_PATH_ADDITIONALATTR04 );}
|
48 |
+
public function getAdditionalAttribute05(){return Mage::getStoreConfig( self::XML_PATH_ADDITIONALATTR05 );}
|
49 |
+
|
50 |
+
public function getProductCategory(){return Mage::getStoreConfig( self::XML_PATH_PRODUCTCATEGORY );}
|
51 |
+
|
52 |
+
public function getGoogleShipping(){return Mage::getStoreConfig( self::XML_PATH_SHIPPINGGOOGLE );}
|
53 |
+
public function getGeneralShipping(){return Mage::getStoreConfig( self::XML_PATH_SHIPPINGGENERAL );}
|
54 |
+
public function getCategoryEnabled(){return Mage::getStoreConfig( self::XML_PATH_CATEGORY_ENABLED );}
|
55 |
+
public function getCategory(){return Mage::getStoreConfig( self::XML_PATH_CATEGORY );}
|
56 |
+
public function getStore(){return Mage::getStoreConfig( self::XML_PATH_STORE );}
|
57 |
+
public function isCronEnabled(){return Mage::getStoreConfig( self::XML_PATH_CRON_ENABLED );}
|
58 |
+
|
59 |
+
public function excludeOptions(){return Mage::getStoreConfig( self::XML_PATH_EXCLUDE_OPTIONS );}
|
60 |
+
}
|
app/code/local/Fsecommerce/Convertizer/Model/Adminhtml/Attribute.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Fsecommerce_Convertizer_Model_Adminhtml_Attribute extends Mage_Adminhtml_Model_System_Store
|
4 |
+
{
|
5 |
+
protected $_url;
|
6 |
+
|
7 |
+
public function toOptionArray()
|
8 |
+
{
|
9 |
+
$options = array('empty'=>'AAA Empty');
|
10 |
+
|
11 |
+
|
12 |
+
$attributes = Mage::getResourceModel('catalog/product_attribute_collection')
|
13 |
+
->getItems();
|
14 |
+
|
15 |
+
foreach ($attributes as $attribute){
|
16 |
+
$attrCode = $attribute->getAttributecode();
|
17 |
+
$options[$attrCode] = $attribute->getFrontendLabel();
|
18 |
+
}
|
19 |
+
|
20 |
+
|
21 |
+
|
22 |
+
return $options;
|
23 |
+
}
|
24 |
+
|
25 |
+
|
26 |
+
}
|
app/code/local/Fsecommerce/Convertizer/Model/Adminhtml/Category.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Fsecommerce_Convertizer_Model_Adminhtml_Category
|
4 |
+
{
|
5 |
+
public function toOptionArray($addEmpty = true)
|
6 |
+
{
|
7 |
+
$tree = Mage::getResourceModel('catalog/category_tree');
|
8 |
+
|
9 |
+
$collection = Mage::getResourceModel('catalog/category_collection');
|
10 |
+
|
11 |
+
$collection->addAttributeToSelect('name')
|
12 |
+
//->addRootLevelFilter()
|
13 |
+
->load();
|
14 |
+
|
15 |
+
$options = array();
|
16 |
+
|
17 |
+
if ($addEmpty) {
|
18 |
+
$options[] = array(
|
19 |
+
'label' => Mage::helper('adminhtml')->__('-- Please Select a Category --'),
|
20 |
+
'value' => ''
|
21 |
+
);
|
22 |
+
}
|
23 |
+
foreach ($collection as $category) {
|
24 |
+
$options[] = array(
|
25 |
+
'label' => $category->getName(),
|
26 |
+
'value' => $category->getId()
|
27 |
+
);
|
28 |
+
}
|
29 |
+
|
30 |
+
return $options;
|
31 |
+
}
|
32 |
+
}
|
app/code/local/Fsecommerce/Convertizer/Model/Adminhtml/Producttype.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Fsecommerce_Convertizer_Model_Adminhtml_Producttype
|
3 |
+
{
|
4 |
+
public function toOptionArray($addEmpty = true)
|
5 |
+
{
|
6 |
+
$collection = Mage::getModel('catalog/product_type')->getOptionArray();
|
7 |
+
$options = array();
|
8 |
+
if ($addEmpty) {
|
9 |
+
$options[] = array(
|
10 |
+
'label' => Mage::helper('adminhtml')->__('-- Please Select Product Types --'),
|
11 |
+
'value' => ''
|
12 |
+
);
|
13 |
+
}
|
14 |
+
foreach ($collection as $key => $value) {
|
15 |
+
$options[] = array(
|
16 |
+
'label' => $value,
|
17 |
+
'value' => $key
|
18 |
+
);
|
19 |
+
}
|
20 |
+
return $options;
|
21 |
+
}
|
22 |
+
}
|
app/code/local/Fsecommerce/Convertizer/Model/Adminhtml/Store.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Fsecommerce_Convertizer_Model_Adminhtml_Store
|
4 |
+
{
|
5 |
+
protected $_options;
|
6 |
+
|
7 |
+
public function toOptionArray()
|
8 |
+
{
|
9 |
+
if (!$this->_options) {
|
10 |
+
$this->_options = Mage::getResourceModel('core/store_collection')
|
11 |
+
->load()->toOptionArray();
|
12 |
+
}
|
13 |
+
return $this->_options;
|
14 |
+
}
|
15 |
+
}
|
app/code/local/Fsecommerce/Convertizer/Model/Feed.php
ADDED
@@ -0,0 +1,521 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Fsecommerce_Convertizer_Model_Feed
|
4 |
+
{
|
5 |
+
public function run()
|
6 |
+
{
|
7 |
+
|
8 |
+
if(!Mage::helper('fsecommerce_convertizer')->isCronEnabled()){
|
9 |
+
return false;
|
10 |
+
}
|
11 |
+
|
12 |
+
// set amount of entries per temp csv
|
13 |
+
$chunksize = 500;
|
14 |
+
|
15 |
+
$storeId = Mage::helper('fsecommerce_convertizer')->getStore();
|
16 |
+
// get the store
|
17 |
+
$defaultStore = Mage::app()
|
18 |
+
->getWebsite()
|
19 |
+
->getDefaultGroup()
|
20 |
+
->getDefaultStoreId();
|
21 |
+
if(!isset($storeId) || $storeId == ""){
|
22 |
+
$storeId = $defaultStore;
|
23 |
+
}
|
24 |
+
|
25 |
+
|
26 |
+
// get the products collection
|
27 |
+
|
28 |
+
|
29 |
+
if(Mage::helper('fsecommerce_convertizer')->getCategoryEnabled()){
|
30 |
+
|
31 |
+
$catCollection = "";
|
32 |
+
|
33 |
+
$categoryids = explode(",",Mage::helper('fsecommerce_convertizer')->getCategory());
|
34 |
+
|
35 |
+
$collection = Mage::getResourceModel('catalog/product_collection')
|
36 |
+
->setStoreId($storeId)
|
37 |
+
->joinField('category_id','catalog/category_product','category_id','product_id=entity_id',null,'left')
|
38 |
+
->addAttributeToFilter('category_id', array('in' => $categoryids))
|
39 |
+
->addStoreFilter();
|
40 |
+
$collection->getSelect()->group('e.entity_id');
|
41 |
+
}else{
|
42 |
+
$collection = Mage::getModel('catalog/product')->getCollection()
|
43 |
+
->setStoreId($storeId)
|
44 |
+
->addStoreFilter();
|
45 |
+
}
|
46 |
+
|
47 |
+
$collection->addFieldToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
|
48 |
+
|
49 |
+
|
50 |
+
// get the total amout of entries
|
51 |
+
$entries = count($collection);
|
52 |
+
// delete files first
|
53 |
+
$files = array();
|
54 |
+
foreach(scandir('./') as $file)
|
55 |
+
{
|
56 |
+
if(substr(basename($file), 0, 15) != 'feed_tmp_chunk_') continue;
|
57 |
+
if(file_exists($file)) unlink($file);
|
58 |
+
}
|
59 |
+
|
60 |
+
|
61 |
+
|
62 |
+
$data = array(
|
63 |
+
array(
|
64 |
+
'id',
|
65 |
+
'parent_id',
|
66 |
+
'variant_attribute',
|
67 |
+
'variant_attribute_value',
|
68 |
+
'shipping_status',
|
69 |
+
'shipping',
|
70 |
+
'custom_attribute_' . $this->getAttributeLabel(Mage::helper('fsecommerce_convertizer')->getCustomAttribute01()),
|
71 |
+
'custom_attribute_' . $this->getAttributeLabel(Mage::helper('fsecommerce_convertizer')->getCustomAttribute02()),
|
72 |
+
'custom_attribute_' . $this->getAttributeLabel(Mage::helper('fsecommerce_convertizer')->getCustomAttribute03()),
|
73 |
+
'custom_attribute_' . $this->getAttributeLabel(Mage::helper('fsecommerce_convertizer')->getCustomAttribute04()),
|
74 |
+
'custom_attribute_' . $this->getAttributeLabel(Mage::helper('fsecommerce_convertizer')->getCustomAttribute05()),
|
75 |
+
$this->getAttributeLabel(Mage::helper('fsecommerce_convertizer')->getAdditionalAttribute01()),
|
76 |
+
$this->getAttributeLabel(Mage::helper('fsecommerce_convertizer')->getAdditionalAttribute02()),
|
77 |
+
$this->getAttributeLabel(Mage::helper('fsecommerce_convertizer')->getAdditionalAttribute03()),
|
78 |
+
$this->getAttributeLabel(Mage::helper('fsecommerce_convertizer')->getAdditionalAttribute04()),
|
79 |
+
$this->getAttributeLabel(Mage::helper('fsecommerce_convertizer')->getAdditionalAttribute05()),
|
80 |
+
'keywords',
|
81 |
+
'title',
|
82 |
+
'description',
|
83 |
+
'image_link',
|
84 |
+
'additional_image_link_1',
|
85 |
+
'additional_image_link_2',
|
86 |
+
'additional_image_link_3',
|
87 |
+
'additional_image_link_4',
|
88 |
+
'additional_image_link_5',
|
89 |
+
'additional_image_link_6',
|
90 |
+
'additional_image_link_7',
|
91 |
+
'additional_image_link_8',
|
92 |
+
'additional_image_link_9',
|
93 |
+
'additional_image_link_10',
|
94 |
+
'availability',
|
95 |
+
'google_product_category',
|
96 |
+
'product_type',
|
97 |
+
'link',
|
98 |
+
'price',
|
99 |
+
'sale_price',
|
100 |
+
'no_singlepage'
|
101 |
+
)
|
102 |
+
);
|
103 |
+
|
104 |
+
$i = 0;
|
105 |
+
|
106 |
+
|
107 |
+
foreach($collection as $product)
|
108 |
+
{
|
109 |
+
$i++;
|
110 |
+
|
111 |
+
#if($i > 50) break;
|
112 |
+
|
113 |
+
$product->load('media_gallery');
|
114 |
+
|
115 |
+
#if($product->getStatus() != 1 && !$export_disabled_products) continue;
|
116 |
+
#if($product->getMenge() <= 0 && !$export_out_of_stock_products) continue;
|
117 |
+
|
118 |
+
$gallery = $product->getMediaGallery();
|
119 |
+
$BaseURL = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
120 |
+
$mediaUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
|
121 |
+
$data[] = array(
|
122 |
+
$product->getSku(),
|
123 |
+
$this->getParentSKU($product),
|
124 |
+
$this->getVariantsLabel($product),
|
125 |
+
$this->getVariantsValue($product),
|
126 |
+
$this->getGoogleShipping($product),
|
127 |
+
$this->getGeneralShipping($product),
|
128 |
+
$this->getCustomAttr01($product),
|
129 |
+
$this->getCustomAttr02($product),
|
130 |
+
$this->getCustomAttr03($product),
|
131 |
+
$this->getCustomAttr04($product),
|
132 |
+
$this->getCustomAttr05($product),
|
133 |
+
$this->getAdditionalAttr01($product),
|
134 |
+
$this->getAdditionalAttr02($product),
|
135 |
+
$this->getAdditionalAttr03($product),
|
136 |
+
$this->getAdditionalAttr04($product),
|
137 |
+
$this->getAdditionalAttr05($product),
|
138 |
+
$this->getKeywords($product),
|
139 |
+
$product->getName(),
|
140 |
+
$product->getDescription(),
|
141 |
+
Mage::getModel('catalog/product_media_config')->getMediaUrl($product->getImage()),
|
142 |
+
isset($gallery['images'][0]) ? $mediaUrl . 'catalog/product' . $gallery['images'][0]['file'] : '',
|
143 |
+
isset($gallery['images'][1]) ? $mediaUrl . 'catalog/product' . $gallery['images'][1]['file'] : '',
|
144 |
+
isset($gallery['images'][2]) ? $mediaUrl . 'catalog/product' . $gallery['images'][2]['file'] : '',
|
145 |
+
isset($gallery['images'][3]) ? $mediaUrl . 'catalog/product' . $gallery['images'][3]['file'] : '',
|
146 |
+
isset($gallery['images'][4]) ? $mediaUrl . 'catalog/product' . $gallery['images'][4]['file'] : '',
|
147 |
+
isset($gallery['images'][5]) ? $mediaUrl . 'catalog/product' . $gallery['images'][5]['file'] : '',
|
148 |
+
isset($gallery['images'][6]) ? $mediaUrl . 'catalog/product' . $gallery['images'][6]['file'] : '',
|
149 |
+
isset($gallery['images'][7]) ? $mediaUrl . 'catalog/product' . $gallery['images'][7]['file'] : '',
|
150 |
+
isset($gallery['images'][8]) ? $mediaUrl . 'catalog/product' . $gallery['images'][8]['file'] : '',
|
151 |
+
isset($gallery['images'][9]) ? $mediaUrl . 'catalog/product' . $gallery['images'][9]['file'] : '',
|
152 |
+
($product->getStatus() == 1 ? 'available' : 'not available'),
|
153 |
+
$this->getProductCategory($product),
|
154 |
+
$product->getProductType(),
|
155 |
+
$BaseURL . $product->getUrlPath(),
|
156 |
+
$product->getPrice(),
|
157 |
+
$product->getFinalPrice() != $product->getPrice() ? $product->getFinalPrice() : '',
|
158 |
+
$this->getExcludeOptions($product)
|
159 |
+
);
|
160 |
+
|
161 |
+
if($i % $chunksize == 0 || $i == $entries)
|
162 |
+
{
|
163 |
+
$fp = fopen('feed_tmp_chunk_' . $this->addzero($i, strlen($entries)) . '.csv', 'w');
|
164 |
+
foreach ($data as $fields) fputcsv($fp, $fields, ';');
|
165 |
+
fclose($fp);
|
166 |
+
ob_clean();
|
167 |
+
$data = array();
|
168 |
+
}
|
169 |
+
}
|
170 |
+
|
171 |
+
// merge feed files and output
|
172 |
+
$files = array();
|
173 |
+
|
174 |
+
foreach(scandir('./') as $file)
|
175 |
+
{
|
176 |
+
if(substr(basename($file), 0, 15) != 'feed_tmp_chunk_') continue;
|
177 |
+
$files[] = $file;
|
178 |
+
}
|
179 |
+
|
180 |
+
ob_end_clean();
|
181 |
+
|
182 |
+
//$result = fopen('php://output', 'w');
|
183 |
+
$csv = "";
|
184 |
+
foreach($files as $i => $file)
|
185 |
+
{
|
186 |
+
$content = $i == count($files) - 1 ? trim(file_get_contents($file)) : file_get_contents($file);
|
187 |
+
//fwrite($result, $content);
|
188 |
+
$csv = $this->joinFiles($files, 'feed.csv');
|
189 |
+
}
|
190 |
+
|
191 |
+
file_put_contents(sprintf('%s/convertizer', Mage::getBaseDir('media')) . '/' . 'convertizer_feed.csv', $csv);
|
192 |
+
|
193 |
+
fclose($result);
|
194 |
+
|
195 |
+
// delete feed files
|
196 |
+
foreach($files as $i => $file)
|
197 |
+
{
|
198 |
+
if(file_exists($file)) unlink($file);
|
199 |
+
}
|
200 |
+
|
201 |
+
}
|
202 |
+
|
203 |
+
public function getAttributeLabel($attributecode){
|
204 |
+
$attributeInfo = Mage::getResourceModel('eav/entity_attribute_collection')
|
205 |
+
->setCodeFilter($attributecode)
|
206 |
+
->getFirstItem();
|
207 |
+
$result = $attributeInfo->getFrontendLabel();
|
208 |
+
return $result;
|
209 |
+
}
|
210 |
+
|
211 |
+
public function getCustomAttr01($product){
|
212 |
+
$customAttribute = Mage::helper('fsecommerce_convertizer')->getCustomAttribute01();
|
213 |
+
if($customAttribute && $customAttribute != "empty"){
|
214 |
+
$result = $product->getResource()->getAttribute($customAttribute)
|
215 |
+
->getFrontend()->getValue($product);
|
216 |
+
return $result;
|
217 |
+
}else{
|
218 |
+
return false;
|
219 |
+
}
|
220 |
+
}
|
221 |
+
|
222 |
+
public function getCustomAttr02($product){
|
223 |
+
$customAttribute = Mage::helper('fsecommerce_convertizer')->getCustomAttribute02();
|
224 |
+
if($customAttribute && $customAttribute != "empty"){
|
225 |
+
$result = $product->getResource()->getAttribute($customAttribute)
|
226 |
+
->getFrontend()->getValue($product);
|
227 |
+
return $result;
|
228 |
+
}else{
|
229 |
+
return false;
|
230 |
+
}
|
231 |
+
}
|
232 |
+
|
233 |
+
public function getCustomAttr03($product){
|
234 |
+
$customAttribute = Mage::helper('fsecommerce_convertizer')->getCustomAttribute03();
|
235 |
+
if($customAttribute && $customAttribute != "empty"){
|
236 |
+
$result = $product->getResource()->getAttribute($customAttribute)
|
237 |
+
->getFrontend()->getValue($product);
|
238 |
+
return $result;
|
239 |
+
}else{
|
240 |
+
return false;
|
241 |
+
}
|
242 |
+
}
|
243 |
+
|
244 |
+
public function getCustomAttr04($product){
|
245 |
+
$customAttribute = Mage::helper('fsecommerce_convertizer')->getCustomAttribute04();
|
246 |
+
if($customAttribute && $customAttribute != "empty"){
|
247 |
+
$result = $product->getResource()->getAttribute($customAttribute)
|
248 |
+
->getFrontend()->getValue($product);
|
249 |
+
return $result;
|
250 |
+
}else{
|
251 |
+
return false;
|
252 |
+
}
|
253 |
+
}
|
254 |
+
|
255 |
+
public function getCustomAttr05($product){
|
256 |
+
$customAttribute = Mage::helper('fsecommerce_convertizer')->getCustomAttribute05();
|
257 |
+
if($customAttribute && $customAttribute != "empty"){
|
258 |
+
$result = $product->getResource()->getAttribute($customAttribute)
|
259 |
+
->getFrontend()->getValue($product);
|
260 |
+
return $result;
|
261 |
+
}else{
|
262 |
+
return false;
|
263 |
+
}
|
264 |
+
}
|
265 |
+
|
266 |
+
public function getAdditionalAttr01($product){
|
267 |
+
$AdditionalAttribute = Mage::helper('fsecommerce_convertizer')->getAdditionalAttribute01();
|
268 |
+
if($AdditionalAttribute && $AdditionalAttribute != "empty"){
|
269 |
+
$result = $product->getResource()->getAttribute($AdditionalAttribute)
|
270 |
+
->getFrontend()->getValue($product);
|
271 |
+
return $result;
|
272 |
+
}else{
|
273 |
+
return false;
|
274 |
+
}
|
275 |
+
}
|
276 |
+
public function getAdditionalAttr02($product){
|
277 |
+
$AdditionalAttribute = Mage::helper('fsecommerce_convertizer')->getAdditionalAttribute02();
|
278 |
+
if($AdditionalAttribute && $AdditionalAttribute != "empty"){
|
279 |
+
$result = $product->getResource()->getAttribute($AdditionalAttribute)
|
280 |
+
->getFrontend()->getValue($product);
|
281 |
+
return $result;
|
282 |
+
}else{
|
283 |
+
return false;
|
284 |
+
}
|
285 |
+
}
|
286 |
+
public function getAdditionalAttr03($product){
|
287 |
+
$AdditionalAttribute = Mage::helper('fsecommerce_convertizer')->getAdditionalAttribute03();
|
288 |
+
if($AdditionalAttribute && $AdditionalAttribute != "empty"){
|
289 |
+
$result = $product->getResource()->getAttribute($AdditionalAttribute)
|
290 |
+
->getFrontend()->getValue($product);
|
291 |
+
return $result;
|
292 |
+
}else{
|
293 |
+
return false;
|
294 |
+
}
|
295 |
+
}
|
296 |
+
public function getAdditionalAttr04($product){
|
297 |
+
$AdditionalAttribute = Mage::helper('fsecommerce_convertizer')->getAdditionalAttribute04();
|
298 |
+
if($AdditionalAttribute && $AdditionalAttribute != "empty"){
|
299 |
+
$result = $product->getResource()->getAttribute($AdditionalAttribute)
|
300 |
+
->getFrontend()->getValue($product);
|
301 |
+
return $result;
|
302 |
+
}else{
|
303 |
+
return false;
|
304 |
+
}
|
305 |
+
}
|
306 |
+
public function getAdditionalAttr05($product){
|
307 |
+
$AdditionalAttribute = Mage::helper('fsecommerce_convertizer')->getAdditionalAttribute05();
|
308 |
+
if($AdditionalAttribute && $AdditionalAttribute != "empty"){
|
309 |
+
$result = $product->getResource()->getAttribute($AdditionalAttribute)
|
310 |
+
->getFrontend()->getValue($product);
|
311 |
+
return $result;
|
312 |
+
}else{
|
313 |
+
return false;
|
314 |
+
}
|
315 |
+
}
|
316 |
+
|
317 |
+
public function getProductCategory($product){
|
318 |
+
$category = Mage::helper('fsecommerce_convertizer')->getProductCategory();
|
319 |
+
if($category && $category != "empty"){
|
320 |
+
$result = $product->getResource()->getAttribute($category)
|
321 |
+
->getFrontend()->getValue($product);
|
322 |
+
return $result;
|
323 |
+
}else{
|
324 |
+
return false;
|
325 |
+
}
|
326 |
+
}
|
327 |
+
|
328 |
+
public function getKeywords($product){
|
329 |
+
$keywords = Mage::helper('fsecommerce_convertizer')->getKeywords();
|
330 |
+
if($keywords && $keywords != "empty"){
|
331 |
+
$result = $product->getResource()->getAttribute($keywords)
|
332 |
+
->getFrontend()->getValue($product);
|
333 |
+
return $result;
|
334 |
+
}else{
|
335 |
+
return false;
|
336 |
+
}
|
337 |
+
}
|
338 |
+
|
339 |
+
|
340 |
+
public function getGoogleShipping($product){
|
341 |
+
|
342 |
+
$attrCode = Mage::helper('fsecommerce_convertizer')->getGoogleShipping();
|
343 |
+
if($attrCode && $attrCode != "empty"){
|
344 |
+
$result = $product->getResource()->getAttribute($attrCode)
|
345 |
+
->getFrontend()->getValue($product);
|
346 |
+
}else{
|
347 |
+
return false;
|
348 |
+
}
|
349 |
+
if($result){
|
350 |
+
return $result;
|
351 |
+
}else{
|
352 |
+
return false;
|
353 |
+
}
|
354 |
+
|
355 |
+
}
|
356 |
+
|
357 |
+
public function getGeneralShipping($product){
|
358 |
+
|
359 |
+
$attrCode = Mage::helper('fsecommerce_convertizer')->getGeneralShipping();
|
360 |
+
if($attrCode && $attrCode != "empty"){
|
361 |
+
$result = $product->getResource()->getAttribute($attrCode)
|
362 |
+
->getFrontend()->getValue($product);
|
363 |
+
}else{
|
364 |
+
return false;
|
365 |
+
}
|
366 |
+
if($result){
|
367 |
+
return $result;
|
368 |
+
}else{
|
369 |
+
return false;
|
370 |
+
}
|
371 |
+
}
|
372 |
+
|
373 |
+
public function getParentSKU($product){
|
374 |
+
$parentArray = $this->getParentProduct($product);
|
375 |
+
|
376 |
+
if(!count($parentArray) || !$parentArray){
|
377 |
+
return false;
|
378 |
+
}
|
379 |
+
|
380 |
+
$parentSkuArray = array();
|
381 |
+
if(count($parentArray) || $parentArray){
|
382 |
+
foreach($parentArray as $parent){
|
383 |
+
$parentSku = $parent->getSku();
|
384 |
+
array_push($parentSkuArray, $parentSku);
|
385 |
+
}
|
386 |
+
}
|
387 |
+
if( count($parentSkuArray) > 0){
|
388 |
+
$parentSkuArray = implode(",", $parentSkuArray);
|
389 |
+
$parentSkuArray = rtrim($parentSkuArray, ",");
|
390 |
+
return $parentSkuArray;
|
391 |
+
}else{
|
392 |
+
return false;
|
393 |
+
}
|
394 |
+
}
|
395 |
+
|
396 |
+
public function getParentProduct($product){
|
397 |
+
$parrentArray = array();
|
398 |
+
if($product->getTypeId() == "simple"){
|
399 |
+
$parentgroupedIds = Mage::getModel('catalog/product_type_grouped')->getParentIdsByChild($product->getId());
|
400 |
+
$parentconfigIds = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId());
|
401 |
+
|
402 |
+
if(!count($parentconfigIds)){
|
403 |
+
return false;
|
404 |
+
}else{
|
405 |
+
foreach ($parentconfigIds as $parentID){
|
406 |
+
$parent = Mage::getModel('catalog/product')->load($parentID);
|
407 |
+
array_push($parrentArray,$parent);
|
408 |
+
}
|
409 |
+
}
|
410 |
+
}
|
411 |
+
return $parrentArray;
|
412 |
+
}
|
413 |
+
|
414 |
+
public function getVariantsLabel($product){
|
415 |
+
// first get the parent Sku
|
416 |
+
|
417 |
+
$parentArray = $this->getParentProduct($product);
|
418 |
+
|
419 |
+
if(!count($parentArray) || !$parentArray){
|
420 |
+
return false;
|
421 |
+
}
|
422 |
+
|
423 |
+
$result = "";
|
424 |
+
foreach ($parentArray as $parent){
|
425 |
+
|
426 |
+
if($parent){
|
427 |
+
$productAttributeOptions = $parent->getTypeInstance(true)->getConfigurableAttributesAsArray($parent);
|
428 |
+
$attributeOptions = array();
|
429 |
+
foreach ($productAttributeOptions as $productAttribute) {
|
430 |
+
$result .= $productAttribute['label'] . ",";
|
431 |
+
}
|
432 |
+
}
|
433 |
+
}
|
434 |
+
$result = rtrim($result, ",");
|
435 |
+
return $result;
|
436 |
+
|
437 |
+
}
|
438 |
+
|
439 |
+
public function getVariantsValue($product){
|
440 |
+
|
441 |
+
$parentArray = $this->getParentProduct($product);
|
442 |
+
|
443 |
+
if(!count($parentArray) || !$parentArray){
|
444 |
+
return false;
|
445 |
+
}
|
446 |
+
|
447 |
+
$result = "";
|
448 |
+
foreach($parentArray as $parent){
|
449 |
+
if($parent){
|
450 |
+
$productAttributeOptions = $parent->getTypeInstance(true)->getConfigurableAttributesAsArray($parent);
|
451 |
+
$attributeOptions = array();
|
452 |
+
foreach ($productAttributeOptions as $productAttribute) {
|
453 |
+
$code = $productAttribute['attribute_code'];
|
454 |
+
$result .= $product->getAttributeText($code) . ",";
|
455 |
+
}
|
456 |
+
}
|
457 |
+
}
|
458 |
+
$result = rtrim($result, ",");
|
459 |
+
return $result;
|
460 |
+
}
|
461 |
+
|
462 |
+
public function getExcludeOptions($product){
|
463 |
+
if(Mage::helper('fsecommerce_convertizer')->excludeOptions()){
|
464 |
+
$opts = Mage::getSingleton('catalog/product_option')->getProductOptionCollection($product);
|
465 |
+
$optsSize = $opts->getSize();
|
466 |
+
if($optsSize){
|
467 |
+
return '1';
|
468 |
+
}else{
|
469 |
+
return '';
|
470 |
+
}
|
471 |
+
}else{
|
472 |
+
return '';
|
473 |
+
}
|
474 |
+
}
|
475 |
+
|
476 |
+
public function joinFiles(array $files, $result) {
|
477 |
+
$fileStr = "";
|
478 |
+
if(!is_array($files)) {
|
479 |
+
throw new Exception('`$files` must be an array');
|
480 |
+
}
|
481 |
+
|
482 |
+
$wH = fopen($result, "w+");
|
483 |
+
|
484 |
+
foreach($files as $file) {
|
485 |
+
$fh = fopen($file, "r");
|
486 |
+
while(!feof($fh)) {
|
487 |
+
//fwrite($wH, fgets($fh));
|
488 |
+
$fileStr .= fgets($fh);
|
489 |
+
}
|
490 |
+
fclose($fh);
|
491 |
+
unset($fh);
|
492 |
+
fwrite($wH, "\n"); //usually last line doesn't have a newline
|
493 |
+
}
|
494 |
+
|
495 |
+
fclose($wH);
|
496 |
+
unset($wH);
|
497 |
+
return $fileStr;
|
498 |
+
}
|
499 |
+
|
500 |
+
public function get_sale_price_effective_date($price, $sale_price, $from, $to)
|
501 |
+
{
|
502 |
+
if($price == $sale_price) return '';
|
503 |
+
|
504 |
+
$ts_from = strtotime($from);
|
505 |
+
$ts_to = strtotime($to);
|
506 |
+
$s_from = date('Y-m-d', $ts_from) . 'T' . date('H:i', $ts_from) . '-0000';
|
507 |
+
$s_to = $ts_to != 0 ? date('Y-m-d', $ts_to) . 'T' . date('H:i', $ts_to) . '-0000' : '3000-01-01T00:00-0000';
|
508 |
+
|
509 |
+
return $s_from . '/' . $s_to;
|
510 |
+
}
|
511 |
+
|
512 |
+
public function addzero($i, $length = 4)
|
513 |
+
{
|
514 |
+
$i_length = strlen($i);
|
515 |
+
$zero_length = $length - $i_length;
|
516 |
+
|
517 |
+
return str_repeat('0', $zero_length) . $i;
|
518 |
+
}
|
519 |
+
|
520 |
+
|
521 |
+
}
|
app/code/local/Fsecommerce/Convertizer/controllers/AddController.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php class Fsecommerce_Convertizer_AddController extends Mage_Core_Controller_Front_Action{
|
2 |
+
public function productAction(){
|
3 |
+
$sku = $this->getRequest()->getParam('sku');
|
4 |
+
Mage::log($sku,Null,'convertizer.log');
|
5 |
+
$redirectUrl = Mage::helper('core/url')->getHomeUrl();
|
6 |
+
if(!empty($sku)){
|
7 |
+
$_product = Mage::getModel('catalog/product')->loadByAttribute('sku', $sku);
|
8 |
+
if($_product && $_product->isSaleable()){
|
9 |
+
try{
|
10 |
+
$product = Mage::getModel('catalog/product')->load($_product->getId());
|
11 |
+
$cart = Mage::getModel('checkout/cart');
|
12 |
+
$cart->init();
|
13 |
+
$cart->addProduct($product, array( 'product_id' => $product->getId(), 'qty' => 1));
|
14 |
+
$cart->save();
|
15 |
+
$params = $this->getRequest()->getParams();
|
16 |
+
unset($params['sku']);
|
17 |
+
unset($params['orig_link']);
|
18 |
+
Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
|
19 |
+
$addparams = "?";
|
20 |
+
|
21 |
+
foreach($params as $key => $param){
|
22 |
+
$addparams .= $key . '=' . $param . '&';
|
23 |
+
}
|
24 |
+
$addparams = rtrim($addparams, "&");
|
25 |
+
$redirectUrl = Mage::helper('checkout/cart')->getCartUrl() . $addparams;
|
26 |
+
}catch(Exception $e){
|
27 |
+
Mage::getSingleton('core/session')->addNotice('Produkt konnte nicht dem Warenkorb hinzugefügt werden. Bitte prüfen Sie ggf. weitere Optionen.');
|
28 |
+
$productUrl = $this->getRequest()->getParam('orig_link');
|
29 |
+
if($productUrl){
|
30 |
+
$redirectUrl = $productUrl;
|
31 |
+
}else{
|
32 |
+
$redirectUrl = Mage::helper('core/url')->getHomeUrl();
|
33 |
+
}
|
34 |
+
}
|
35 |
+
}
|
36 |
+
}
|
37 |
+
$this->_redirectUrl($redirectUrl);
|
38 |
+
}
|
39 |
+
|
40 |
+
public function cartAction(){
|
41 |
+
$basket = json_decode($this->getRequest()->getParam('basket'),true);
|
42 |
+
$redirectUrl = Mage::helper('core/url')->getHomeUrl();
|
43 |
+
$result = array();
|
44 |
+
if(count($basket)){
|
45 |
+
$cart = Mage::getModel('checkout/cart');
|
46 |
+
$cart->init();
|
47 |
+
foreach($basket[0] as $k => $v){
|
48 |
+
$_product = Mage::getModel('catalog/product')->loadByAttribute('sku', $k);
|
49 |
+
if($_product && $_product->isSaleable()){
|
50 |
+
try{
|
51 |
+
$product = Mage::getModel('catalog/product')->load($_product->getId());
|
52 |
+
$cart->addProduct($product, array( 'product_id' => $product->getId(), 'qty' => $v));
|
53 |
+
}catch(Exception $e){
|
54 |
+
Mage::getSingleton('core/session')->addNotice("Produkt (SKU: $k) konnte nicht dem Warenkorb hinzugefügt werden. Bitte prüfen Sie ggf. weitere Optionen.");
|
55 |
+
}
|
56 |
+
}else{
|
57 |
+
Mage::getSingleton('core/session')->addNotice("Produkt (SKU: $k) konnte nicht dem Warenkorb hinzugefügt werden.");
|
58 |
+
}
|
59 |
+
}
|
60 |
+
$cart->save();
|
61 |
+
$params = $this->getRequest()->getParams();
|
62 |
+
unset($params['basket']);
|
63 |
+
unset($params['orig_link']);
|
64 |
+
Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
|
65 |
+
$addparams = "?";
|
66 |
+
|
67 |
+
foreach ($params as $key => $param) {
|
68 |
+
$addparams .= $key . '=' . $param . '&';
|
69 |
+
}
|
70 |
+
$addparams = rtrim($addparams, "&");
|
71 |
+
$redirectUrl = Mage::helper('checkout/cart')->getCartUrl() . $addparams;
|
72 |
+
}
|
73 |
+
|
74 |
+
$this->_redirectUrl($redirectUrl);
|
75 |
+
}
|
76 |
+
|
77 |
+
}
|
app/code/local/Fsecommerce/Convertizer/controllers/Adminhtml/FeedController.php
ADDED
@@ -0,0 +1,510 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Fsecommerce_Convertizer_Adminhtml_FeedController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
|
6 |
+
public function generateAction()
|
7 |
+
{
|
8 |
+
|
9 |
+
// set amount of entries per temp csv
|
10 |
+
$chunksize = 500;
|
11 |
+
$storeId = Mage::helper('fsecommerce_convertizer')->getStore();
|
12 |
+
// get the store
|
13 |
+
$defaultStore = Mage::app()
|
14 |
+
->getWebsite()
|
15 |
+
->getDefaultGroup()
|
16 |
+
->getDefaultStoreId();
|
17 |
+
if(!isset($storeId) || $storeId == ""){
|
18 |
+
$storeId = $defaultStore;
|
19 |
+
}
|
20 |
+
|
21 |
+
|
22 |
+
// get the products collection
|
23 |
+
|
24 |
+
|
25 |
+
if(Mage::helper('fsecommerce_convertizer')->getCategoryEnabled()){
|
26 |
+
|
27 |
+
$categoryids = explode(",",Mage::helper('fsecommerce_convertizer')->getCategory());
|
28 |
+
|
29 |
+
$collection = Mage::getResourceModel('catalog/product_collection')
|
30 |
+
->setStoreId($storeId)
|
31 |
+
->joinField('category_id','catalog/category_product','category_id','product_id=entity_id',null,'left')
|
32 |
+
->addAttributeToFilter('category_id', array('in' => $categoryids))
|
33 |
+
->addStoreFilter();
|
34 |
+
|
35 |
+
$collection->getSelect()->group('e.entity_id');
|
36 |
+
}else{
|
37 |
+
$collection = Mage::getModel('catalog/product')->getCollection()
|
38 |
+
->setStoreId($storeId)
|
39 |
+
->addStoreFilter();
|
40 |
+
}
|
41 |
+
|
42 |
+
$collection->addFieldToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
|
43 |
+
|
44 |
+
// get the total amout of entries
|
45 |
+
$entries = count($collection);
|
46 |
+
// delete files first
|
47 |
+
$files = array();
|
48 |
+
foreach(scandir('./') as $file)
|
49 |
+
{
|
50 |
+
if(substr(basename($file), 0, 15) != 'feed_tmp_chunk_') continue;
|
51 |
+
if(file_exists($file)) unlink($file);
|
52 |
+
}
|
53 |
+
|
54 |
+
$data = array(
|
55 |
+
array(
|
56 |
+
'id',
|
57 |
+
'parent_id',
|
58 |
+
'variant_attribute',
|
59 |
+
'variant_attribute_value',
|
60 |
+
'shipping_status',
|
61 |
+
'shipping',
|
62 |
+
'custom_attribute_' . $this->getAttributeLabel(Mage::helper('fsecommerce_convertizer')->getCustomAttribute01()),
|
63 |
+
'custom_attribute_' . $this->getAttributeLabel(Mage::helper('fsecommerce_convertizer')->getCustomAttribute02()),
|
64 |
+
'custom_attribute_' . $this->getAttributeLabel(Mage::helper('fsecommerce_convertizer')->getCustomAttribute03()),
|
65 |
+
'custom_attribute_' . $this->getAttributeLabel(Mage::helper('fsecommerce_convertizer')->getCustomAttribute04()),
|
66 |
+
'custom_attribute_' . $this->getAttributeLabel(Mage::helper('fsecommerce_convertizer')->getCustomAttribute05()),
|
67 |
+
$this->getAttributeLabel(Mage::helper('fsecommerce_convertizer')->getAdditionalAttribute01()),
|
68 |
+
$this->getAttributeLabel(Mage::helper('fsecommerce_convertizer')->getAdditionalAttribute02()),
|
69 |
+
$this->getAttributeLabel(Mage::helper('fsecommerce_convertizer')->getAdditionalAttribute03()),
|
70 |
+
$this->getAttributeLabel(Mage::helper('fsecommerce_convertizer')->getAdditionalAttribute04()),
|
71 |
+
$this->getAttributeLabel(Mage::helper('fsecommerce_convertizer')->getAdditionalAttribute05()),
|
72 |
+
'keywords',
|
73 |
+
'title',
|
74 |
+
'description',
|
75 |
+
'image_link',
|
76 |
+
'additional_image_link_1',
|
77 |
+
'additional_image_link_2',
|
78 |
+
'additional_image_link_3',
|
79 |
+
'additional_image_link_4',
|
80 |
+
'additional_image_link_5',
|
81 |
+
'additional_image_link_6',
|
82 |
+
'additional_image_link_7',
|
83 |
+
'additional_image_link_8',
|
84 |
+
'additional_image_link_9',
|
85 |
+
'additional_image_link_10',
|
86 |
+
'availability',
|
87 |
+
'google_product_category',
|
88 |
+
'product_type',
|
89 |
+
'link',
|
90 |
+
'price',
|
91 |
+
'sale_price',
|
92 |
+
'no_singlepage'
|
93 |
+
)
|
94 |
+
);
|
95 |
+
|
96 |
+
|
97 |
+
$i = 0;
|
98 |
+
|
99 |
+
|
100 |
+
foreach($collection as $product)
|
101 |
+
{
|
102 |
+
$i++;
|
103 |
+
|
104 |
+
#if($i > 50) break;
|
105 |
+
|
106 |
+
$product->load('media_gallery');
|
107 |
+
|
108 |
+
#if($product->getStatus() != 1 && !$export_disabled_products) continue;
|
109 |
+
#if($product->getMenge() <= 0 && !$export_out_of_stock_products) continue;
|
110 |
+
|
111 |
+
$gallery = $product->getMediaGallery();
|
112 |
+
$BaseURL = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
113 |
+
$mediaUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
|
114 |
+
$data[] = array(
|
115 |
+
$product->getSku(),
|
116 |
+
$this->getParentSKU($product),
|
117 |
+
$this->getVariantsLabel($product),
|
118 |
+
$this->getVariantsValue($product),
|
119 |
+
$this->getGoogleShipping($product),
|
120 |
+
$this->getGeneralShipping($product),
|
121 |
+
$this->getCustomAttr01($product),
|
122 |
+
$this->getCustomAttr02($product),
|
123 |
+
$this->getCustomAttr03($product),
|
124 |
+
$this->getCustomAttr04($product),
|
125 |
+
$this->getCustomAttr05($product),
|
126 |
+
$this->getAdditionalAttr01($product),
|
127 |
+
$this->getAdditionalAttr02($product),
|
128 |
+
$this->getAdditionalAttr03($product),
|
129 |
+
$this->getAdditionalAttr04($product),
|
130 |
+
$this->getAdditionalAttr05($product),
|
131 |
+
$this->getKeywords($product),
|
132 |
+
$product->getName(),
|
133 |
+
$product->getDescription(),
|
134 |
+
Mage::getModel('catalog/product_media_config')->getMediaUrl($product->getImage()),
|
135 |
+
isset($gallery['images'][0]) ? $mediaUrl . 'catalog/product' . $gallery['images'][0]['file'] : '',
|
136 |
+
isset($gallery['images'][1]) ? $mediaUrl . 'catalog/product' . $gallery['images'][1]['file'] : '',
|
137 |
+
isset($gallery['images'][2]) ? $mediaUrl . 'catalog/product' . $gallery['images'][2]['file'] : '',
|
138 |
+
isset($gallery['images'][3]) ? $mediaUrl . 'catalog/product' . $gallery['images'][3]['file'] : '',
|
139 |
+
isset($gallery['images'][4]) ? $mediaUrl . 'catalog/product' . $gallery['images'][4]['file'] : '',
|
140 |
+
isset($gallery['images'][5]) ? $mediaUrl . 'catalog/product' . $gallery['images'][5]['file'] : '',
|
141 |
+
isset($gallery['images'][6]) ? $mediaUrl . 'catalog/product' . $gallery['images'][6]['file'] : '',
|
142 |
+
isset($gallery['images'][7]) ? $mediaUrl . 'catalog/product' . $gallery['images'][7]['file'] : '',
|
143 |
+
isset($gallery['images'][8]) ? $mediaUrl . 'catalog/product' . $gallery['images'][8]['file'] : '',
|
144 |
+
isset($gallery['images'][9]) ? $mediaUrl . 'catalog/product' . $gallery['images'][9]['file'] : '',
|
145 |
+
($product->getStatus() == 1 ? 'available' : 'not available'),
|
146 |
+
$this->getProductCategory($product),
|
147 |
+
$product->getProductType(),
|
148 |
+
$BaseURL . $product->getUrlPath(),
|
149 |
+
$product->getPrice(),
|
150 |
+
$product->getFinalPrice() != $product->getPrice() ? $product->getFinalPrice() : '',
|
151 |
+
$this->getExcludeOptions($product)
|
152 |
+
);
|
153 |
+
|
154 |
+
|
155 |
+
if($i % $chunksize == 0 || $i == $entries)
|
156 |
+
{
|
157 |
+
$fp = fopen('feed_tmp_chunk_' . $this->addzero($i, strlen($entries)) . '.csv', 'w');
|
158 |
+
foreach ($data as $fields) fputcsv($fp, $fields, ';');
|
159 |
+
fclose($fp);
|
160 |
+
ob_clean();
|
161 |
+
$data = array();
|
162 |
+
}
|
163 |
+
}
|
164 |
+
|
165 |
+
// merge feed files and output
|
166 |
+
$files = array();
|
167 |
+
|
168 |
+
foreach(scandir('./') as $file)
|
169 |
+
{
|
170 |
+
if(substr(basename($file), 0, 15) != 'feed_tmp_chunk_') continue;
|
171 |
+
$files[] = $file;
|
172 |
+
}
|
173 |
+
|
174 |
+
ob_end_clean();
|
175 |
+
|
176 |
+
//$result = fopen('php://output', 'w');
|
177 |
+
$csv = "";
|
178 |
+
foreach($files as $i => $file)
|
179 |
+
{
|
180 |
+
$content = $i == count($files) - 1 ? trim(file_get_contents($file)) : file_get_contents($file);
|
181 |
+
//fwrite($result, $content);
|
182 |
+
$csv = $this->joinFiles($files, 'feed.csv');
|
183 |
+
}
|
184 |
+
|
185 |
+
file_put_contents(sprintf('%s/convertizer', Mage::getBaseDir('media')) . '/' . 'convertizer_feed.csv', $csv);
|
186 |
+
|
187 |
+
fclose($result);
|
188 |
+
|
189 |
+
// delete feed files
|
190 |
+
foreach($files as $i => $file)
|
191 |
+
{
|
192 |
+
if(file_exists($file)) unlink($file);
|
193 |
+
}
|
194 |
+
|
195 |
+
}
|
196 |
+
|
197 |
+
public function getAttributeLabel($attributecode){
|
198 |
+
$attributeInfo = Mage::getResourceModel('eav/entity_attribute_collection')
|
199 |
+
->setCodeFilter($attributecode)
|
200 |
+
->getFirstItem();
|
201 |
+
$result = $attributeInfo->getFrontendLabel();
|
202 |
+
return $result;
|
203 |
+
}
|
204 |
+
|
205 |
+
public function getCustomAttr01($product){
|
206 |
+
$customAttribute = Mage::helper('fsecommerce_convertizer')->getCustomAttribute01();
|
207 |
+
if($customAttribute && $customAttribute != "empty"){
|
208 |
+
$result = $product->getResource()->getAttribute($customAttribute)
|
209 |
+
->getFrontend()->getValue($product);
|
210 |
+
return $result;
|
211 |
+
}else{
|
212 |
+
return false;
|
213 |
+
}
|
214 |
+
}
|
215 |
+
|
216 |
+
public function getCustomAttr02($product){
|
217 |
+
$customAttribute = Mage::helper('fsecommerce_convertizer')->getCustomAttribute02();
|
218 |
+
if($customAttribute && $customAttribute != "empty"){
|
219 |
+
$result = $product->getResource()->getAttribute($customAttribute)
|
220 |
+
->getFrontend()->getValue($product);
|
221 |
+
return $result;
|
222 |
+
}else{
|
223 |
+
return false;
|
224 |
+
}
|
225 |
+
}
|
226 |
+
|
227 |
+
public function getCustomAttr03($product){
|
228 |
+
$customAttribute = Mage::helper('fsecommerce_convertizer')->getCustomAttribute03();
|
229 |
+
if($customAttribute && $customAttribute != "empty"){
|
230 |
+
$result = $product->getResource()->getAttribute($customAttribute)
|
231 |
+
->getFrontend()->getValue($product);
|
232 |
+
return $result;
|
233 |
+
}else{
|
234 |
+
return false;
|
235 |
+
}
|
236 |
+
}
|
237 |
+
|
238 |
+
public function getCustomAttr04($product){
|
239 |
+
$customAttribute = Mage::helper('fsecommerce_convertizer')->getCustomAttribute04();
|
240 |
+
if($customAttribute && $customAttribute != "empty"){
|
241 |
+
$result = $product->getResource()->getAttribute($customAttribute)
|
242 |
+
->getFrontend()->getValue($product);
|
243 |
+
return $result;
|
244 |
+
}else{
|
245 |
+
return false;
|
246 |
+
}
|
247 |
+
}
|
248 |
+
|
249 |
+
public function getCustomAttr05($product){
|
250 |
+
$customAttribute = Mage::helper('fsecommerce_convertizer')->getCustomAttribute05();
|
251 |
+
if($customAttribute && $customAttribute != "empty"){
|
252 |
+
$result = $product->getResource()->getAttribute($customAttribute)
|
253 |
+
->getFrontend()->getValue($product);
|
254 |
+
return $result;
|
255 |
+
}else{
|
256 |
+
return false;
|
257 |
+
}
|
258 |
+
}
|
259 |
+
|
260 |
+
public function getAdditionalAttr01($product){
|
261 |
+
$AdditionalAttribute = Mage::helper('fsecommerce_convertizer')->getAdditionalAttribute01();
|
262 |
+
if($AdditionalAttribute && $AdditionalAttribute != "empty"){
|
263 |
+
$result = $product->getResource()->getAttribute($AdditionalAttribute)
|
264 |
+
->getFrontend()->getValue($product);
|
265 |
+
return $result;
|
266 |
+
}else{
|
267 |
+
return false;
|
268 |
+
}
|
269 |
+
}
|
270 |
+
public function getAdditionalAttr02($product){
|
271 |
+
$AdditionalAttribute = Mage::helper('fsecommerce_convertizer')->getAdditionalAttribute02();
|
272 |
+
if($AdditionalAttribute && $AdditionalAttribute != "empty"){
|
273 |
+
$result = $product->getResource()->getAttribute($AdditionalAttribute)
|
274 |
+
->getFrontend()->getValue($product);
|
275 |
+
return $result;
|
276 |
+
}else{
|
277 |
+
return false;
|
278 |
+
}
|
279 |
+
}
|
280 |
+
public function getAdditionalAttr03($product){
|
281 |
+
$AdditionalAttribute = Mage::helper('fsecommerce_convertizer')->getAdditionalAttribute03();
|
282 |
+
if($AdditionalAttribute && $AdditionalAttribute != "empty"){
|
283 |
+
$result = $product->getResource()->getAttribute($AdditionalAttribute)
|
284 |
+
->getFrontend()->getValue($product);
|
285 |
+
return $result;
|
286 |
+
}else{
|
287 |
+
return false;
|
288 |
+
}
|
289 |
+
}
|
290 |
+
public function getAdditionalAttr04($product){
|
291 |
+
$AdditionalAttribute = Mage::helper('fsecommerce_convertizer')->getAdditionalAttribute04();
|
292 |
+
if($AdditionalAttribute && $AdditionalAttribute != "empty"){
|
293 |
+
$result = $product->getResource()->getAttribute($AdditionalAttribute)
|
294 |
+
->getFrontend()->getValue($product);
|
295 |
+
return $result;
|
296 |
+
}else{
|
297 |
+
return false;
|
298 |
+
}
|
299 |
+
}
|
300 |
+
public function getAdditionalAttr05($product){
|
301 |
+
$AdditionalAttribute = Mage::helper('fsecommerce_convertizer')->getAdditionalAttribute05();
|
302 |
+
if($AdditionalAttribute && $AdditionalAttribute != "empty"){
|
303 |
+
$result = $product->getResource()->getAttribute($AdditionalAttribute)
|
304 |
+
->getFrontend()->getValue($product);
|
305 |
+
return $result;
|
306 |
+
}else{
|
307 |
+
return false;
|
308 |
+
}
|
309 |
+
}
|
310 |
+
|
311 |
+
public function getProductCategory($product){
|
312 |
+
$category = Mage::helper('fsecommerce_convertizer')->getProductCategory();
|
313 |
+
if($category && $category != "empty"){
|
314 |
+
$result = $product->getResource()->getAttribute($category)
|
315 |
+
->getFrontend()->getValue($product);
|
316 |
+
return $result;
|
317 |
+
}else{
|
318 |
+
return false;
|
319 |
+
}
|
320 |
+
}
|
321 |
+
|
322 |
+
public function getKeywords($product){
|
323 |
+
$keywords = Mage::helper('fsecommerce_convertizer')->getKeywords();
|
324 |
+
if($keywords && $keywords != "empty"){
|
325 |
+
$result = $product->getResource()->getAttribute($keywords)
|
326 |
+
->getFrontend()->getValue($product);
|
327 |
+
return $result;
|
328 |
+
}else{
|
329 |
+
return false;
|
330 |
+
}
|
331 |
+
}
|
332 |
+
|
333 |
+
public function getGoogleShipping($product){
|
334 |
+
|
335 |
+
$attrCode = Mage::helper('fsecommerce_convertizer')->getGoogleShipping();
|
336 |
+
if($attrCode && $attrCode != "empty"){
|
337 |
+
$result = $product->getResource()->getAttribute($attrCode)
|
338 |
+
->getFrontend()->getValue($product);
|
339 |
+
}else{
|
340 |
+
return false;
|
341 |
+
}
|
342 |
+
if($result){
|
343 |
+
return $result;
|
344 |
+
}else{
|
345 |
+
return false;
|
346 |
+
}
|
347 |
+
|
348 |
+
}
|
349 |
+
|
350 |
+
public function getGeneralShipping($product){
|
351 |
+
|
352 |
+
$attrCode = Mage::helper('fsecommerce_convertizer')->getGeneralShipping();
|
353 |
+
if($attrCode && $attrCode != "empty"){
|
354 |
+
$result = $product->getResource()->getAttribute($attrCode)
|
355 |
+
->getFrontend()->getValue($product);
|
356 |
+
}else{
|
357 |
+
return false;
|
358 |
+
}
|
359 |
+
if($result){
|
360 |
+
return $result;
|
361 |
+
}else{
|
362 |
+
return false;
|
363 |
+
}
|
364 |
+
}
|
365 |
+
|
366 |
+
public function getParentSKU($product){
|
367 |
+
$parentArray = $this->getParentProduct($product);
|
368 |
+
|
369 |
+
if(!count($parentArray) || !$parentArray){
|
370 |
+
return false;
|
371 |
+
}
|
372 |
+
|
373 |
+
$parentSkuArray = array();
|
374 |
+
if(count($parentArray) || $parentArray){
|
375 |
+
foreach($parentArray as $parent){
|
376 |
+
$parentSku = $parent->getSku();
|
377 |
+
array_push($parentSkuArray, $parentSku);
|
378 |
+
}
|
379 |
+
}
|
380 |
+
if( count($parentSkuArray) > 0){
|
381 |
+
$parentSkuArray = implode(",", $parentSkuArray);
|
382 |
+
$parentSkuArray = rtrim($parentSkuArray, ",");
|
383 |
+
return $parentSkuArray;
|
384 |
+
}else{
|
385 |
+
return false;
|
386 |
+
}
|
387 |
+
}
|
388 |
+
|
389 |
+
public function getParentProduct($product){
|
390 |
+
$parrentArray = array();
|
391 |
+
if($product->getTypeId() == "simple"){
|
392 |
+
$parentgroupedIds = Mage::getModel('catalog/product_type_grouped')->getParentIdsByChild($product->getId());
|
393 |
+
$parentconfigIds = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId());
|
394 |
+
|
395 |
+
if(!count($parentconfigIds)){
|
396 |
+
return false;
|
397 |
+
}else{
|
398 |
+
foreach ($parentconfigIds as $parentID){
|
399 |
+
$parent = Mage::getModel('catalog/product')->load($parentID);
|
400 |
+
array_push($parrentArray,$parent);
|
401 |
+
}
|
402 |
+
}
|
403 |
+
}
|
404 |
+
return $parrentArray;
|
405 |
+
}
|
406 |
+
|
407 |
+
public function getVariantsLabel($product){
|
408 |
+
// first get the parent Sku
|
409 |
+
|
410 |
+
$parentArray = $this->getParentProduct($product);
|
411 |
+
if(!count($parentArray) || !$parentArray){
|
412 |
+
return false;
|
413 |
+
}
|
414 |
+
$result = "";
|
415 |
+
foreach ($parentArray as $parent){
|
416 |
+
|
417 |
+
if($parent){
|
418 |
+
$productAttributeOptions = $parent->getTypeInstance(true)->getConfigurableAttributesAsArray($parent);
|
419 |
+
$attributeOptions = array();
|
420 |
+
foreach ($productAttributeOptions as $productAttribute) {
|
421 |
+
$result .= $productAttribute['label'] . ",";
|
422 |
+
}
|
423 |
+
}
|
424 |
+
}
|
425 |
+
$result = rtrim($result, ",");
|
426 |
+
return $result;
|
427 |
+
|
428 |
+
}
|
429 |
+
|
430 |
+
public function getVariantsValue($product){
|
431 |
+
|
432 |
+
$parentArray = $this->getParentProduct($product);
|
433 |
+
|
434 |
+
if(!count($parentArray) || !$parentArray){
|
435 |
+
return false;
|
436 |
+
}
|
437 |
+
|
438 |
+
$result = "";
|
439 |
+
foreach($parentArray as $parent){
|
440 |
+
if($parent){
|
441 |
+
$productAttributeOptions = $parent->getTypeInstance(true)->getConfigurableAttributesAsArray($parent);
|
442 |
+
$attributeOptions = array();
|
443 |
+
foreach ($productAttributeOptions as $productAttribute) {
|
444 |
+
$code = $productAttribute['attribute_code'];
|
445 |
+
$result .= $product->getAttributeText($code) . ",";
|
446 |
+
}
|
447 |
+
}
|
448 |
+
}
|
449 |
+
$result = rtrim($result, ",");
|
450 |
+
return $result;
|
451 |
+
}
|
452 |
+
|
453 |
+
public function getExcludeOptions($product){
|
454 |
+
if(Mage::helper('fsecommerce_convertizer')->excludeOptions()){
|
455 |
+
$opts = Mage::getSingleton('catalog/product_option')->getProductOptionCollection($product);
|
456 |
+
$optsSize = $opts->getSize();
|
457 |
+
if($optsSize){
|
458 |
+
return '1';
|
459 |
+
}else{
|
460 |
+
return '';
|
461 |
+
}
|
462 |
+
}else{
|
463 |
+
return '';
|
464 |
+
}
|
465 |
+
}
|
466 |
+
|
467 |
+
public function joinFiles(array $files, $result) {
|
468 |
+
$fileStr = "";
|
469 |
+
if(!is_array($files)) {
|
470 |
+
throw new Exception('`$files` must be an array');
|
471 |
+
}
|
472 |
+
|
473 |
+
$wH = fopen($result, "w+");
|
474 |
+
|
475 |
+
foreach($files as $file) {
|
476 |
+
$fh = fopen($file, "r");
|
477 |
+
while(!feof($fh)) {
|
478 |
+
//fwrite($wH, fgets($fh));
|
479 |
+
$fileStr .= fgets($fh);
|
480 |
+
}
|
481 |
+
fclose($fh);
|
482 |
+
unset($fh);
|
483 |
+
fwrite($wH, "\n"); //usually last line doesn't have a newline
|
484 |
+
}
|
485 |
+
|
486 |
+
fclose($wH);
|
487 |
+
unset($wH);
|
488 |
+
return $fileStr;
|
489 |
+
}
|
490 |
+
|
491 |
+
public function get_sale_price_effective_date($price, $sale_price, $from, $to)
|
492 |
+
{
|
493 |
+
if($price == $sale_price) return '';
|
494 |
+
|
495 |
+
$ts_from = strtotime($from);
|
496 |
+
$ts_to = strtotime($to);
|
497 |
+
$s_from = date('Y-m-d', $ts_from) . 'T' . date('H:i', $ts_from) . '-0000';
|
498 |
+
$s_to = $ts_to != 0 ? date('Y-m-d', $ts_to) . 'T' . date('H:i', $ts_to) . '-0000' : '3000-01-01T00:00-0000';
|
499 |
+
|
500 |
+
return $s_from . '/' . $s_to;
|
501 |
+
}
|
502 |
+
|
503 |
+
public function addzero($i, $length = 4)
|
504 |
+
{
|
505 |
+
$i_length = strlen($i);
|
506 |
+
$zero_length = $length - $i_length;
|
507 |
+
|
508 |
+
return str_repeat('0', $zero_length) . $i;
|
509 |
+
}
|
510 |
+
}
|
app/code/local/Fsecommerce/Convertizer/etc/config.xml
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Fsecommerce_Convertizer>
|
5 |
+
<version>0.0.1</version>
|
6 |
+
</Fsecommerce_Convertizer>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<fsecommerce_convertizer>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Fsecommerce_Convertizer</module>
|
14 |
+
<frontName>convertizer</frontName>
|
15 |
+
</args>
|
16 |
+
</fsecommerce_convertizer>
|
17 |
+
</routers>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<fsecommerce_convertizer>
|
21 |
+
<file>fsecommerce_convertizer.xml</file>
|
22 |
+
</fsecommerce_convertizer>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
</frontend>
|
26 |
+
<global>
|
27 |
+
<helpers>
|
28 |
+
<fsecommerce_convertizer>
|
29 |
+
<class>Fsecommerce_Convertizer_Helper</class>
|
30 |
+
</fsecommerce_convertizer>
|
31 |
+
</helpers>
|
32 |
+
<blocks>
|
33 |
+
<fsecommerce_convertizer>
|
34 |
+
<class>Fsecommerce_Convertizer_Block</class>
|
35 |
+
</fsecommerce_convertizer>
|
36 |
+
</blocks>
|
37 |
+
<models>
|
38 |
+
<fsecommerce_convertizer>
|
39 |
+
<class>Fsecommerce_Convertizer_Model</class>
|
40 |
+
</fsecommerce_convertizer>
|
41 |
+
</models>
|
42 |
+
</global>
|
43 |
+
<crontab>
|
44 |
+
<jobs>
|
45 |
+
<fsecommerce_convertizer>
|
46 |
+
<schedule><cron_expr>*/60 * * * *</cron_expr></schedule>
|
47 |
+
<run><model>fsecommerce_convertizer/feed::run</model></run>
|
48 |
+
</fsecommerce_convertizer>
|
49 |
+
</jobs>
|
50 |
+
</crontab>
|
51 |
+
<admin>
|
52 |
+
<routers>
|
53 |
+
<fsecommerce_convertizer>
|
54 |
+
<use>admin</use>
|
55 |
+
<args>
|
56 |
+
<frontName>convertizer</frontName>
|
57 |
+
<module>Fsecommerce_Convertizer</module>
|
58 |
+
<modules>
|
59 |
+
<Fsecommerce_Convertizer before="Mage_Adminhtml">Fsecommerce_Convertizer_Adminhtml</Fsecommerce_Convertizer>
|
60 |
+
</modules>
|
61 |
+
</args>
|
62 |
+
</fsecommerce_convertizer>
|
63 |
+
</routers>
|
64 |
+
</admin>
|
65 |
+
<adminhtml>
|
66 |
+
<acl>
|
67 |
+
<resources>
|
68 |
+
<all>
|
69 |
+
<title>Allow Everything</title>
|
70 |
+
</all>
|
71 |
+
<admin>
|
72 |
+
<children>
|
73 |
+
<system>
|
74 |
+
<children>
|
75 |
+
<config>
|
76 |
+
<children>
|
77 |
+
<fsecommerce_convertizer>
|
78 |
+
<title>Fsecommerce_Convertizer</title>
|
79 |
+
</fsecommerce_convertizer>
|
80 |
+
</children>
|
81 |
+
</config>
|
82 |
+
</children>
|
83 |
+
</system>
|
84 |
+
</children>
|
85 |
+
</admin>
|
86 |
+
</resources>
|
87 |
+
</acl>
|
88 |
+
</adminhtml>
|
89 |
+
</config>
|
app/code/local/Fsecommerce/Convertizer/etc/system.xml
ADDED
@@ -0,0 +1,257 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<fsecommerce_convertizer translate="label" module="fsecommerce_convertizer">
|
5 |
+
<label><![CDATA[<img src="http://fs-ecommerce.com/convertizer/convertizer.png" alt="Convertizer" height="30" style="vertical-align:middle;margin-left:-1px;margin-right: 10px;"/>]]>Convertizer</label>
|
6 |
+
<sort_order>0</sort_order>
|
7 |
+
</fsecommerce_convertizer>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<fsecommerce_convertizer translate="label" module="fsecommerce_convertizer">
|
11 |
+
<label>Convertizer Settings</label>
|
12 |
+
<tab>fsecommerce_convertizer</tab>
|
13 |
+
<sort_order>10</sort_order>
|
14 |
+
<show_in_default>1</show_in_default>
|
15 |
+
<show_in_website>1</show_in_website>
|
16 |
+
<show_in_store>1</show_in_store>
|
17 |
+
<groups>
|
18 |
+
<feed translate="label">
|
19 |
+
<label>Feed Settings (choose storeview to generate feed by click)</label>
|
20 |
+
<sort_order>1</sort_order>
|
21 |
+
<show_in_default>1</show_in_default>
|
22 |
+
<show_in_website>1</show_in_website>
|
23 |
+
<show_in_store>1</show_in_store>
|
24 |
+
<fields>
|
25 |
+
<check translate="label">
|
26 |
+
<label>Generate Convertizer Feed</label>
|
27 |
+
<frontend_type>button</frontend_type>
|
28 |
+
<frontend_model>fsecommerce_convertizer/adminhtml_feed</frontend_model>
|
29 |
+
<sort_order>10</sort_order>
|
30 |
+
<show_in_default>0</show_in_default>
|
31 |
+
<show_in_website>0</show_in_website>
|
32 |
+
<show_in_store>1</show_in_store>
|
33 |
+
</check>
|
34 |
+
<shipping_google translate="label">
|
35 |
+
<label>Attribute for Google Shipping Description</label>
|
36 |
+
<frontend_type>select</frontend_type>
|
37 |
+
<source_model>fsecommerce_convertizer/adminhtml_attribute</source_model>
|
38 |
+
<sort_order>20</sort_order>
|
39 |
+
<show_in_default>1</show_in_default>
|
40 |
+
<show_in_website>1</show_in_website>
|
41 |
+
<show_in_store>1</show_in_store>
|
42 |
+
</shipping_google>
|
43 |
+
<shipping_general translate="label">
|
44 |
+
<label>Attribute for General Shipping Values</label>
|
45 |
+
<frontend_type>select</frontend_type>
|
46 |
+
<source_model>fsecommerce_convertizer/adminhtml_attribute</source_model>
|
47 |
+
<sort_order>30</sort_order>
|
48 |
+
<show_in_default>1</show_in_default>
|
49 |
+
<show_in_website>1</show_in_website>
|
50 |
+
<show_in_store>1</show_in_store>
|
51 |
+
</shipping_general>
|
52 |
+
<custom_attr_01 translate="label">
|
53 |
+
<label>Custom Attribut to Show 01</label>
|
54 |
+
<frontend_type>select</frontend_type>
|
55 |
+
<source_model>fsecommerce_convertizer/adminhtml_attribute</source_model>
|
56 |
+
<sort_order>40</sort_order>
|
57 |
+
<show_in_default>1</show_in_default>
|
58 |
+
<show_in_website>1</show_in_website>
|
59 |
+
<show_in_store>1</show_in_store>
|
60 |
+
</custom_attr_01>
|
61 |
+
<custom_attr_02 translate="label">
|
62 |
+
<label>Custom Attribut to Show 02</label>
|
63 |
+
<frontend_type>select</frontend_type>
|
64 |
+
<source_model>fsecommerce_convertizer/adminhtml_attribute</source_model>
|
65 |
+
<sort_order>50</sort_order>
|
66 |
+
<show_in_default>1</show_in_default>
|
67 |
+
<show_in_website>1</show_in_website>
|
68 |
+
<show_in_store>1</show_in_store>
|
69 |
+
</custom_attr_02>
|
70 |
+
<custom_attr_03 translate="label">
|
71 |
+
<label>Custom Attribut to Show 03</label>
|
72 |
+
<frontend_type>select</frontend_type>
|
73 |
+
<source_model>fsecommerce_convertizer/adminhtml_attribute</source_model>
|
74 |
+
<sort_order>60</sort_order>
|
75 |
+
<show_in_default>1</show_in_default>
|
76 |
+
<show_in_website>1</show_in_website>
|
77 |
+
<show_in_store>1</show_in_store>
|
78 |
+
</custom_attr_03>
|
79 |
+
<custom_attr_04 translate="label">
|
80 |
+
<label>Custom Attribut to Show 04</label>
|
81 |
+
<frontend_type>select</frontend_type>
|
82 |
+
<source_model>fsecommerce_convertizer/adminhtml_attribute</source_model>
|
83 |
+
<sort_order>70</sort_order>
|
84 |
+
<show_in_default>1</show_in_default>
|
85 |
+
<show_in_website>1</show_in_website>
|
86 |
+
<show_in_store>1</show_in_store>
|
87 |
+
</custom_attr_04>
|
88 |
+
<custom_attr_05 translate="label">
|
89 |
+
<label>Custom Attribut to Show 05</label>
|
90 |
+
<frontend_type>select</frontend_type>
|
91 |
+
<source_model>fsecommerce_convertizer/adminhtml_attribute</source_model>
|
92 |
+
<sort_order>80</sort_order>
|
93 |
+
<show_in_default>1</show_in_default>
|
94 |
+
<show_in_website>1</show_in_website>
|
95 |
+
<show_in_store>1</show_in_store>
|
96 |
+
</custom_attr_05>
|
97 |
+
<additional_attr_01 translate="label">
|
98 |
+
<label>Additional Attribut 01</label>
|
99 |
+
<comment>Choose an additional attribute to be used for convertizer engine</comment>
|
100 |
+
<frontend_type>select</frontend_type>
|
101 |
+
<source_model>fsecommerce_convertizer/adminhtml_attribute</source_model>
|
102 |
+
<sort_order>90</sort_order>
|
103 |
+
<show_in_default>1</show_in_default>
|
104 |
+
<show_in_website>1</show_in_website>
|
105 |
+
<show_in_store>1</show_in_store>
|
106 |
+
</additional_attr_01>
|
107 |
+
<additional_attr_02 translate="label">
|
108 |
+
<label>Additional Attribut 02</label>
|
109 |
+
<comment>Choose an additional attribute to be used for convertizer engine</comment>
|
110 |
+
<frontend_type>select</frontend_type>
|
111 |
+
<source_model>fsecommerce_convertizer/adminhtml_attribute</source_model>
|
112 |
+
<sort_order>100</sort_order>
|
113 |
+
<show_in_default>1</show_in_default>
|
114 |
+
<show_in_website>1</show_in_website>
|
115 |
+
<show_in_store>1</show_in_store>
|
116 |
+
</additional_attr_02>
|
117 |
+
<additional_attr_03 translate="label">
|
118 |
+
<label>Additional Attribut 03</label>
|
119 |
+
<comment>Choose an additional attribute to be used for convertizer engine</comment>
|
120 |
+
<frontend_type>select</frontend_type>
|
121 |
+
<source_model>fsecommerce_convertizer/adminhtml_attribute</source_model>
|
122 |
+
<sort_order>110</sort_order>
|
123 |
+
<show_in_default>1</show_in_default>
|
124 |
+
<show_in_website>1</show_in_website>
|
125 |
+
<show_in_store>1</show_in_store>
|
126 |
+
</additional_attr_03>
|
127 |
+
<additional_attr_04 translate="label">
|
128 |
+
<label>Additional Attribut 04</label>
|
129 |
+
<comment>Choose an additional attribute to be used for convertizer engine</comment>
|
130 |
+
<frontend_type>select</frontend_type>
|
131 |
+
<source_model>fsecommerce_convertizer/adminhtml_attribute</source_model>
|
132 |
+
<sort_order>120</sort_order>
|
133 |
+
<show_in_default>1</show_in_default>
|
134 |
+
<show_in_website>1</show_in_website>
|
135 |
+
<show_in_store>1</show_in_store>
|
136 |
+
</additional_attr_04>
|
137 |
+
<additional_attr_05 translate="label">
|
138 |
+
<label>Additional Attribut 05</label>
|
139 |
+
<comment>Choose an additional attribute to be used for convertizer engine</comment>
|
140 |
+
<frontend_type>select</frontend_type>
|
141 |
+
<source_model>fsecommerce_convertizer/adminhtml_attribute</source_model>
|
142 |
+
<sort_order>130</sort_order>
|
143 |
+
<show_in_default>1</show_in_default>
|
144 |
+
<show_in_website>1</show_in_website>
|
145 |
+
<show_in_store>1</show_in_store>
|
146 |
+
</additional_attr_05>
|
147 |
+
<product_category translate="label">
|
148 |
+
<label>Product Category Tree</label>
|
149 |
+
<comment>Choose the attribute that holds the products category tree (cat > subcat ...)</comment>
|
150 |
+
<frontend_type>select</frontend_type>
|
151 |
+
<source_model>fsecommerce_convertizer/adminhtml_attribute</source_model>
|
152 |
+
<sort_order>140</sort_order>
|
153 |
+
<show_in_default>1</show_in_default>
|
154 |
+
<show_in_website>1</show_in_website>
|
155 |
+
<show_in_store>1</show_in_store>
|
156 |
+
</product_category>
|
157 |
+
<keywords translate="label">
|
158 |
+
<label>Keyword Attribut</label>
|
159 |
+
<comment>Choose an attribute which contains keywords for the product</comment>
|
160 |
+
<frontend_type>select</frontend_type>
|
161 |
+
<source_model>fsecommerce_convertizer/adminhtml_attribute</source_model>
|
162 |
+
<sort_order>150</sort_order>
|
163 |
+
<show_in_default>1</show_in_default>
|
164 |
+
<show_in_website>1</show_in_website>
|
165 |
+
<show_in_store>1</show_in_store>
|
166 |
+
</keywords>
|
167 |
+
<category_filter_enabled translate="label">
|
168 |
+
<label>Activate Category Filter</label>
|
169 |
+
<frontend_type>select</frontend_type>
|
170 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
171 |
+
<sort_order>160</sort_order>
|
172 |
+
<show_in_default>1</show_in_default>
|
173 |
+
<show_in_website>1</show_in_website>
|
174 |
+
<show_in_store>1</show_in_store>
|
175 |
+
</category_filter_enabled>
|
176 |
+
<category_filter translate="label">
|
177 |
+
<label>Generate Feed for Category only:</label>
|
178 |
+
<depends><category_filter_enabled>1</category_filter_enabled></depends>
|
179 |
+
<frontend_type>multiselect</frontend_type>
|
180 |
+
<source_model>fsecommerce_convertizer/adminhtml_category</source_model>
|
181 |
+
<sort_order>170</sort_order>
|
182 |
+
<show_in_default>1</show_in_default>
|
183 |
+
<show_in_website>1</show_in_website>
|
184 |
+
<show_in_store>1</show_in_store>
|
185 |
+
</category_filter>
|
186 |
+
<exclude_options>
|
187 |
+
<label>Redirect Products with Individual Options</label>
|
188 |
+
<frontend_type>select</frontend_type>
|
189 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
190 |
+
<sort_order>170</sort_order>
|
191 |
+
<show_in_default>1</show_in_default>
|
192 |
+
<show_in_website>1</show_in_website>
|
193 |
+
<show_in_store>1</show_in_store>
|
194 |
+
</exclude_options>
|
195 |
+
</fields>
|
196 |
+
</feed>
|
197 |
+
<cron>
|
198 |
+
<label>Cron Settings</label>
|
199 |
+
<sort_order>2</sort_order>
|
200 |
+
<show_in_default>1</show_in_default>
|
201 |
+
<show_in_website>1</show_in_website>
|
202 |
+
<show_in_store>1</show_in_store>
|
203 |
+
<fields>
|
204 |
+
<cron_enabled translate="label">
|
205 |
+
<label>Activate Cron</label>
|
206 |
+
<frontend_type>select</frontend_type>
|
207 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
208 |
+
<sort_order>10</sort_order>
|
209 |
+
<show_in_default>1</show_in_default>
|
210 |
+
<show_in_website>1</show_in_website>
|
211 |
+
<show_in_store>1</show_in_store>
|
212 |
+
</cron_enabled>
|
213 |
+
<default_store translate="label">
|
214 |
+
<label>Set Cronjob Default Store</label>
|
215 |
+
<depends><cron_enabled>1</cron_enabled></depends>
|
216 |
+
<frontend_type>select</frontend_type>
|
217 |
+
<source_model>fsecommerce_convertizer/adminhtml_store</source_model>
|
218 |
+
<comment><![CDATA[<b>Set the default Store for Product Export by Cron</b>]]></comment>
|
219 |
+
<sort_order>20</sort_order>
|
220 |
+
<show_in_default>1</show_in_default>
|
221 |
+
<show_in_website>1</show_in_website>
|
222 |
+
<show_in_store>1</show_in_store>
|
223 |
+
</default_store>
|
224 |
+
</fields>
|
225 |
+
</cron>
|
226 |
+
<tracking>
|
227 |
+
<label>Tracking</label>
|
228 |
+
<sort_order>3</sort_order>
|
229 |
+
<show_in_default>1</show_in_default>
|
230 |
+
<show_in_website>1</show_in_website>
|
231 |
+
<show_in_store>1</show_in_store>
|
232 |
+
<fields>
|
233 |
+
<enabled translate="label">
|
234 |
+
<label>Activate Tracking</label>
|
235 |
+
<frontend_type>select</frontend_type>
|
236 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
237 |
+
<sort_order>10</sort_order>
|
238 |
+
<show_in_default>1</show_in_default>
|
239 |
+
<show_in_website>1</show_in_website>
|
240 |
+
<show_in_store>1</show_in_store>
|
241 |
+
</enabled>
|
242 |
+
<track translate="label">
|
243 |
+
<label>Convertizer Tracking Code</label>
|
244 |
+
<depends><enabled>1</enabled></depends>
|
245 |
+
<frontend_type>text</frontend_type>
|
246 |
+
<comment><![CDATA[<b>Type in your Convertizer Tracking ID</b>]]></comment>
|
247 |
+
<sort_order>20</sort_order>
|
248 |
+
<show_in_default>1</show_in_default>
|
249 |
+
<show_in_website>1</show_in_website>
|
250 |
+
<show_in_store>1</show_in_store>
|
251 |
+
</track>
|
252 |
+
</fields>
|
253 |
+
</tracking>
|
254 |
+
</groups>
|
255 |
+
</fsecommerce_convertizer>
|
256 |
+
</sections>
|
257 |
+
</config>
|
app/design/adminhtml/default/default/template/convertizer/feed.phtml
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$mediaURL = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
|
3 |
+
?>
|
4 |
+
<script type="text/javascript">
|
5 |
+
//<![CDATA[
|
6 |
+
function generateconvertizerfeed() {
|
7 |
+
new Ajax.Request('<?php echo $this->generateFeed() ?>', {
|
8 |
+
method: 'get',
|
9 |
+
onSuccess: function(transport){
|
10 |
+
var resultHtml = "<div style='background:#fff;padding:20px;margin-top:20px;'><p><?php echo $this->__('Your Feed has been generated!'); ?></p><p><?php echo $this->__('Find your feed here:'); ?> <a href='<?php echo $mediaURL; ?>convertizer/convertizer_feed.csv'><?php echo $mediaURL; ?>convertizer/convertizer_feed.csv</a></p></div>";
|
11 |
+
document.getElementById("feedresult").innerHTML=resultHtml;
|
12 |
+
}
|
13 |
+
});
|
14 |
+
}
|
15 |
+
//]]>
|
16 |
+
</script>
|
17 |
+
|
18 |
+
<?php echo $this->getButtonHtml() ?>
|
19 |
+
|
20 |
+
<span id="feedresult"></span>
|
21 |
+
|
22 |
+
|
app/design/frontend/base/default/layout/fsecommerce_convertizer.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<layout version="0.1.0">
|
4 |
+
<checkout_onepage_success>
|
5 |
+
<reference name="before_body_end">
|
6 |
+
<block type="core/template" name="fsecommerce.convertizer.tracking" template="fse/convertizer/convertizer_tracking.phtml"/>
|
7 |
+
</reference>
|
8 |
+
</checkout_onepage_success>
|
9 |
+
</layout>
|
app/design/frontend/base/default/template/fse/convertizer/convertizer_tracking.phtml
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$_order = Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getLastOrderId());
|
3 |
+
$_orderIncrement = Mage::getSingleton('checkout/session')->getLastRealOrderId();
|
4 |
+
$_items = $_order->getAllItems();
|
5 |
+
$helper = Mage::helper('fsecommerce_convertizer');
|
6 |
+
?>
|
7 |
+
|
8 |
+
<?php $total = $_order->getData('grand_total')-$_order->getTaxAmount()-($_order->getShippingAmount() + $_order->getShippingTaxAmount()); ?>
|
9 |
+
|
10 |
+
<script type="text/javascript">
|
11 |
+
/* FS eCommerce Convertizer Tracking Code*/
|
12 |
+
//<![CDATA[
|
13 |
+
var trackingid = '<?php echo $helper->getTrackingCode() ?>'; //CUSTOMER TRACKING ID
|
14 |
+
var amount = '<?php echo $total; ?>'; //GRAND TOTAL - TAX AMOUNT - SHIPPING AMOUNT
|
15 |
+
var ordertype = 1; //ORDER TYPE
|
16 |
+
var orderid = '<?php echo $_orderIncrement; ?>'; //ORDER ID
|
17 |
+
(function(){
|
18 |
+
var js = document.createElement('script');
|
19 |
+
js.type = 'text/javascript';
|
20 |
+
js.async = true;
|
21 |
+
js.src = ('https:' == document.location.protocol ?
|
22 |
+
'https://' : 'http://') + 'app.convertizer.com/static/convertizer.js';
|
23 |
+
var tag = document.getElementsByTagName('script')[0];
|
24 |
+
tag.parentNode.insertBefore(js, tag);
|
25 |
+
})();
|
26 |
+
//]]>
|
27 |
+
/* Convertizer Tracking Code*/
|
28 |
+
</script>
|
app/etc/modules/Fsecommerce_Convertizer.xml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<config>
|
2 |
+
<modules>
|
3 |
+
<Fsecommerce_Convertizer>
|
4 |
+
<active>true</active>
|
5 |
+
<codePool>local</codePool>
|
6 |
+
</Fsecommerce_Convertizer>
|
7 |
+
</modules>
|
8 |
+
</config>
|
media/convertizer/readme.txt
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
convertizer feed gets saved in this folder, please do not delete this folder
|
package.xml
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Fsecommerce_Convertizer</name>
|
4 |
+
<version>0.0.1</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>GNU General Public License (GPL)</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Dynamic landingpage that auto aligns with your AdWords ads to ensure that visitor see what ads promise</summary>
|
10 |
+
<description>convertizer - dynamic adwords landingpage
|
11 |
+

|
12 |
+
Challenge
|
13 |
+
Creating landingpages in Magento is extremely time consuming and super complex. Especially when you think about ensuring to have the right landingpage for any AdWords keyword you book on! 
|
14 |
+

|
15 |
+
Solution
|
16 |
+
convertizer is the worlds first dynamic landingpage: Once you connected your Magento Onlineshop with convertizer by using this module, you simply choose what Google AdWords should see a high converting landingpage. User coming from your AdWords will see automatically the best matching products to your ads. 
|
17 |
+
convertizer creates within minutes high converting landingpages for Google AdWords traffic. Using convertizer enables you to show visitors what they search for. The landingpage auto aligns with your ads and dynamically shows the products matching to the keywords of your ads. WOW!</description>
|
18 |
+
<notes>Please full-backup your Magento (files and database before installing this extension.</notes>
|
19 |
+
<authors><author><name>FS eCommerce GmbH</name><user>convertizer</user><email>sales@convertizer.com</email></author></authors>
|
20 |
+
<date>2016-04-21</date>
|
21 |
+
<time>06:58:50</time>
|
22 |
+
<contents><target name="magelocal"><dir name="Fsecommerce"><dir name="Convertizer"><dir name="Block"><dir name="Adminhtml"><file name="Feed.php" hash="676448c8583ad7ae11070d9468184f95"/></dir></dir><dir name="Helper"><file name="Data.php" hash="0aafb55e931f7f4a4a9a2064dab7d358"/></dir><dir name="Model"><dir name="Adminhtml"><file name="Attribute.php" hash="8d0deaa682477f711bdf8c36ad94487e"/><file name="Category.php" hash="36ca04071700c37d92eadc5df2ca48da"/><file name="Producttype.php" hash="cb6705aa83eb2ed4a4b872ba9830d04f"/><file name="Store.php" hash="b5c1ee01a538b33c2ab96cdf0da51461"/></dir><file name="Feed.php" hash="830333bc6d99ce42244296d66a071cfa"/></dir><dir name="controllers"><file name="AddController.php" hash="9324435715de603f75ff8f596ea79922"/><dir name="Adminhtml"><file name="FeedController.php" hash="ae62047bc73cb8c859a76310101ceae3"/></dir></dir><dir name="etc"><file name="config.xml" hash="8cee9fedfdbaaaf7a6293128fd42f9a4"/><file name="system.xml" hash="8528630a7a107ec726acb33d0d775770"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Fsecommerce_Convertizer.xml" hash="e510a7119308f4e66b0608c106ab6c79"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="convertizer"><file name="feed.phtml" hash="3ff3d1bdf2de3a76e19a02b5094eddda"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="fse"><dir name="convertizer"><file name="convertizer_tracking.phtml" hash="0d0fd37425f89bb27c3d01395ab0bb1d"/></dir></dir></dir><dir name="layout"><file name="fsecommerce_convertizer.xml" hash="69aa25a87b4aeadcc70f1e19cf68664f"/></dir></dir></dir></dir></target><target name="magemedia"><dir name="convertizer"><file name="readme.txt" hash="0aa0ded81c80c93176c14b295d6d66d9"/></dir></target></contents>
|
23 |
+
<compatible/>
|
24 |
+
<dependencies><required><php><min>5.0.0</min><max>7.0.5</max></php></required></dependencies>
|
25 |
+
</package>
|