Version Notes
- An issue which caused only the product feed headings to export on some magento installations has been resolved.
Download this release
Release Info
Developer | Stephen Short |
Extension | AffiliateWindow |
Version | 1.0.3 |
Comparing to | |
See all releases |
Code changes from version 1.0.2 to 1.0.3
app/code/local/DigitalWindow/AwinTracking/Model/Observer.php
CHANGED
@@ -1,78 +1,87 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class DigitalWindow_AwinTracking_Model_Observer {
|
4 |
-
public function fireTracking(Varien_Event_Observer $observer){
|
5 |
-
|
6 |
-
$feedName = Mage::getStoreConfig("AwinTracking_options/section_two/feed_name");
|
7 |
-
$scheduledTime = Mage::getStoreConfig("AwinTracking_options/section_two/my_date");
|
8 |
-
Mage::log(
|
9 |
-
"FiredTrack", null, 'sale-logs.log'
|
10 |
-
);
|
11 |
-
}
|
12 |
-
|
13 |
-
public function schedule()
|
14 |
-
{
|
15 |
-
$_product = array();
|
16 |
-
$product_data = array();
|
17 |
-
$arr = array();
|
18 |
-
$web_id = Mage::getStoreConfig('AwinTracking_Datafeed/section_one/
|
19 |
-
$fileName = Mage::getStoreConfig('AwinTracking_Datafeed/section_one/feed_name');
|
20 |
-
$fileName = $fileName.'.csv';
|
21 |
-
$collection = Mage::getModel('catalog/product')->getCollection()->addWebsiteFilter($web_id)->addAttributeToSelect('*');
|
22 |
-
$collection->addFieldToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH);
|
23 |
-
foreach ($collection as $product)
|
24 |
-
{
|
25 |
-
$stock_item = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
|
26 |
-
$isInStock = $stock_item->getIsInStock();
|
27 |
-
$product_data["pid"]=$product->getId();
|
28 |
-
$product_data['qty'] = $stock_item->getQty();;
|
29 |
-
if ($product_data['qty'] > 0)
|
30 |
-
{
|
31 |
-
$product_data['stock_status']=1;
|
32 |
-
}else {
|
33 |
-
$product_data['stock_status']=0;
|
34 |
-
}
|
35 |
-
if ($product->isSalable() == 1)
|
36 |
-
{
|
37 |
-
$product_data['isforsale']=1;
|
38 |
-
}else {
|
39 |
-
$product_data['isforsale']=0;
|
40 |
-
}
|
41 |
-
$product_data["product_name"]=$product->getName();
|
42 |
-
$product_data['product_description']=$product->getDescription();
|
43 |
-
$product_data["price"]=$product->getPrice();
|
44 |
-
$product_data['store_price']=$product->getFinalPrice();
|
45 |
-
$categoryIds = $product->getCategoryIds();
|
46 |
-
if (count($categoryIds))
|
47 |
-
{
|
48 |
-
$firstCategoryId = $categoryIds[0];
|
49 |
-
$_category = Mage::getModel('catalog/category')->load($firstCategoryId);
|
50 |
-
$product_data['category'] = $_category->getName();
|
51 |
-
}else {
|
52 |
-
$product_data['category'] = "";
|
53 |
-
}
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
$headers['
|
68 |
-
$headers['
|
69 |
-
$
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
?>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class DigitalWindow_AwinTracking_Model_Observer {
|
4 |
+
public function fireTracking(Varien_Event_Observer $observer){
|
5 |
+
|
6 |
+
$feedName = Mage::getStoreConfig("AwinTracking_options/section_two/feed_name");
|
7 |
+
$scheduledTime = Mage::getStoreConfig("AwinTracking_options/section_two/my_date");
|
8 |
+
Mage::log(
|
9 |
+
"FiredTrack", null, 'sale-logs.log'
|
10 |
+
);
|
11 |
+
}
|
12 |
+
|
13 |
+
public function schedule()
|
14 |
+
{
|
15 |
+
$_product = array();
|
16 |
+
$product_data = array();
|
17 |
+
$arr = array();
|
18 |
+
$web_id = Mage::getStoreConfig('AwinTracking_Datafeed/section_one/website');
|
19 |
+
$fileName = Mage::getStoreConfig('AwinTracking_Datafeed/section_one/feed_name');
|
20 |
+
$fileName = $fileName.'.csv';
|
21 |
+
$collection = Mage::getModel('catalog/product')->getCollection()->addWebsiteFilter($web_id)->addAttributeToSelect('*');
|
22 |
+
$collection->addFieldToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH);
|
23 |
+
foreach ($collection as $product)
|
24 |
+
{
|
25 |
+
$stock_item = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
|
26 |
+
$isInStock = $stock_item->getIsInStock();
|
27 |
+
$product_data["pid"]=$product->getId();
|
28 |
+
$product_data['qty'] = $stock_item->getQty();;
|
29 |
+
if ($product_data['qty'] > 0)
|
30 |
+
{
|
31 |
+
$product_data['stock_status']=1;
|
32 |
+
}else {
|
33 |
+
$product_data['stock_status']=0;
|
34 |
+
}
|
35 |
+
if ($product->isSalable() == 1)
|
36 |
+
{
|
37 |
+
$product_data['isforsale']=1;
|
38 |
+
}else {
|
39 |
+
$product_data['isforsale']=0;
|
40 |
+
}
|
41 |
+
$product_data["product_name"]=$product->getName();
|
42 |
+
$product_data['product_description']=$product->getDescription();
|
43 |
+
$product_data["price"]=$product->getPrice();
|
44 |
+
$product_data['store_price']=$product->getFinalPrice();
|
45 |
+
$categoryIds = $product->getCategoryIds();
|
46 |
+
if (count($categoryIds))
|
47 |
+
{
|
48 |
+
$firstCategoryId = $categoryIds[0];
|
49 |
+
$_category = Mage::getModel('catalog/category')->load($firstCategoryId);
|
50 |
+
$product_data['category'] = $_category->getName();
|
51 |
+
}else {
|
52 |
+
$product_data['category'] = "";
|
53 |
+
}
|
54 |
+
|
55 |
+
try{
|
56 |
+
if($product->getImageUrl()){
|
57 |
+
$product_data['image_url'] = $product->getImageUrl();
|
58 |
+
}
|
59 |
+
}catch(Exception $e){
|
60 |
+
$product_data['image_url'] = "No Image found in Magento Catalogue.";
|
61 |
+
}
|
62 |
+
|
63 |
+
|
64 |
+
$product_data['product_url']=str_replace('pr_magento_exporter.php/','',$product->getProductUrl());
|
65 |
+
array_push($arr, $product_data);
|
66 |
+
}
|
67 |
+
$headers['product_id'] = 'product_id';
|
68 |
+
$headers['quantity'] = 'quantity';
|
69 |
+
$headers['in_stock'] = 'in_stock';
|
70 |
+
$headers['isforsale'] = 'is_for_sale';
|
71 |
+
$headers['product_name'] = 'product_name';
|
72 |
+
$headers['description'] = 'description';
|
73 |
+
$headers['price'] = 'price';
|
74 |
+
$headers['store_price'] = 'store_price';
|
75 |
+
$headers['merchant_category'] = 'merchant_category';
|
76 |
+
$headers['image_url'] = 'image_url';
|
77 |
+
$headers['product_url'] = 'product_url';
|
78 |
+
$file = fopen($fileName, 'w');
|
79 |
+
fputcsv($file, $headers);
|
80 |
+
foreach ($arr as $line)
|
81 |
+
{
|
82 |
+
fputcsv($file, $line);
|
83 |
+
}
|
84 |
+
fclose($file);
|
85 |
+
}
|
86 |
+
}
|
87 |
?>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>AffiliateWindow</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
<license>GNU</license>
|
7 |
<channel>community</channel>
|
@@ -10,11 +10,11 @@
|
|
10 |
One click installation of Affiliate Window's bespoke tracking and datafeed platform.</summary>
|
11 |
<description>Affiliate Window's Official Magento Extension.
|
12 |
One click installation of Affiliate Window's bespoke tracking and datafeed platform.</description>
|
13 |
-
<notes>-
|
14 |
<authors><author><name>Stephen Short</name><user>stephenshort</user><email>Stephen.Short@affiliatewindow.com</email></author><author><name>Vladimir Sofroniev</name><user>vladimirsofroniev</user><email>Vladimir.Sofroniev@affiliatewindow.com</email></author><author><name>Edgelson Lua</name><user>edgelsonlua</user><email>Edgelson.Lua@affiliatewindow.com</email></author><author><name>Oliver Smith</name><user>oliversmith</user><email>Oliver.Smith@affiliatewindow.com</email></author></authors>
|
15 |
-
<date>2016-03-
|
16 |
-
<time>
|
17 |
-
<contents><target name="mageetc"><dir name="modules"><file name="DigitalWindow_AwinTracking.xml" hash="3739f607424fe88e27289a0ea5019aed"/></dir></target><target name="magelocal"><dir name="DigitalWindow"><dir name="AwinTracking"><dir><dir name="Block"><file name="Awintracking.php" hash="7c11c3ebf4f2c9601b13c3dfe1385957"/><file name="Cookie.php" hash="f15ca577e469e0b020a23ade64182ae3"/><file name="Mastertag.php" hash="4b373913f02fa8b3f2d52312a14422d8"/></dir><dir name="Helper"><file name="Data.php" hash="c5a3c31d029ba2826605ce4f65f1d2db"/></dir><dir name="Model"><file name="Observer.php" hash="
|
18 |
<compatible/>
|
19 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
20 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>AffiliateWindow</name>
|
4 |
+
<version>1.0.3</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>GNU</license>
|
7 |
<channel>community</channel>
|
10 |
One click installation of Affiliate Window's bespoke tracking and datafeed platform.</summary>
|
11 |
<description>Affiliate Window's Official Magento Extension.
|
12 |
One click installation of Affiliate Window's bespoke tracking and datafeed platform.</description>
|
13 |
+
<notes>- An issue which caused only the product feed headings to export on some magento installations has been resolved.</notes>
|
14 |
<authors><author><name>Stephen Short</name><user>stephenshort</user><email>Stephen.Short@affiliatewindow.com</email></author><author><name>Vladimir Sofroniev</name><user>vladimirsofroniev</user><email>Vladimir.Sofroniev@affiliatewindow.com</email></author><author><name>Edgelson Lua</name><user>edgelsonlua</user><email>Edgelson.Lua@affiliatewindow.com</email></author><author><name>Oliver Smith</name><user>oliversmith</user><email>Oliver.Smith@affiliatewindow.com</email></author></authors>
|
15 |
+
<date>2016-03-22</date>
|
16 |
+
<time>10:55:17</time>
|
17 |
+
<contents><target name="mageetc"><dir name="modules"><file name="DigitalWindow_AwinTracking.xml" hash="3739f607424fe88e27289a0ea5019aed"/></dir></target><target name="magelocal"><dir name="DigitalWindow"><dir name="AwinTracking"><dir><dir name="Block"><file name="Awintracking.php" hash="7c11c3ebf4f2c9601b13c3dfe1385957"/><file name="Cookie.php" hash="f15ca577e469e0b020a23ade64182ae3"/><file name="Mastertag.php" hash="4b373913f02fa8b3f2d52312a14422d8"/></dir><dir name="Helper"><file name="Data.php" hash="c5a3c31d029ba2826605ce4f65f1d2db"/></dir><dir name="Model"><file name="Observer.php" hash="dd42ee8f837c3a58a4a2de850a6ca930"/><dir name="System"><dir name="Config"><dir name="Backend"><file name="Cookie.php" hash="50f06b4fcfca368033664d0eb5c9b7c9"/><file name="DefaultValue.php" hash="5d50db729cddc93cf4edac2369a1d395"/><file name="FeedName.php" hash="27c58e95203d12f93f5ec999367b51f6"/><file name="KeyParam.php" hash="39d3c69129f1e959d77b604e46f6f790"/><file name="MerchantId.php" hash="26428dec0c735ecb6c8f94fd4d2aa6a6"/></dir><dir name="Clock"><file name="Frequency.php" hash="6a13b43ef6004527a37f115a3243e52a"/></dir><dir name="Store"><file name="Id.php" hash="dc04605e1dd977956e8e1c7c474aeced"/></dir></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="dc37b4397842f39ee0e2bd565f8f2083"/><file name="config.xml" hash="20e28c1e6f142657bf727b7d54add776"/><file name="system.xml" hash="71600ade309186b091e8b17a3568bfdc"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="digitalwindow"><dir><dir name="awintracking"><file name="awintracking.phtml" hash="39ee017118d4da5c1f3ab23a8d3889d0"/><file name="dwin1.phtml" hash="9fb45f13061159776dcae4772c49dfd0"/></dir></dir></dir></dir><dir name="layout"><file name="digitalwindow_awintracking.xml" hash="fea2f002706ecedb9ea2d757412a2fbd"/></dir></dir></dir></dir></target></contents>
|
18 |
<compatible/>
|
19 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
20 |
</package>
|