Version Notes
Free Version
Download this release
Release Info
Developer | Magento Core Team |
Extension | FacebookProductDirectoryCommunity |
Version | 0.1.4 |
Comparing to | |
See all releases |
Code changes from version 0.1.3 to 0.1.4
- app/code/local/Magestore/Facebook/Helper/Data.php +5 -3
- app/code/local/Magestore/Facebook/Model/Export.php +160 -22
- app/code/local/Magestore/Facebook/controllers/IndexController.php +79 -7
- app/code/local/Magestore/Facebook/etc/config.xml +6 -6
- app/code/local/Magestore/Facebook/etc/system.xml +15 -13
- package.xml +4 -4
app/code/local/Magestore/Facebook/Helper/Data.php
CHANGED
@@ -10,7 +10,9 @@ class Magestore_Facebook_Helper_Data extends Mage_Core_Helper_Abstract
|
|
10 |
|
11 |
return $data;
|
12 |
}
|
13 |
-
|
|
|
|
|
14 |
public function sendDataToUrl($data,$url)
|
15 |
{
|
16 |
try{
|
@@ -18,9 +20,9 @@ class Magestore_Facebook_Helper_Data extends Mage_Core_Helper_Abstract
|
|
18 |
|
19 |
foreach($data as $key=>$value)
|
20 |
{
|
21 |
-
$data_string .= $key.'='.$value.'&';
|
22 |
}
|
23 |
-
|
24 |
rtrim($data_string,'&');
|
25 |
|
26 |
$ch = curl_init();
|
10 |
|
11 |
return $data;
|
12 |
}
|
13 |
+
public function getTotalProduct(){
|
14 |
+
|
15 |
+
}
|
16 |
public function sendDataToUrl($data,$url)
|
17 |
{
|
18 |
try{
|
20 |
|
21 |
foreach($data as $key=>$value)
|
22 |
{
|
23 |
+
$data_string .= $key.'='.$value.'&version=0.1.2&';
|
24 |
}
|
25 |
+
$data_string .= 'version=0.1.2&app_type=magento&';
|
26 |
rtrim($data_string,'&');
|
27 |
|
28 |
$ch = curl_init();
|
app/code/local/Magestore/Facebook/Model/Export.php
CHANGED
@@ -6,7 +6,10 @@ class Magestore_Facebook_Model_Export extends Mage_Core_Model_Abstract
|
|
6 |
protected $_simplerss;
|
7 |
protected $_productCollection;
|
8 |
protected $_product;
|
9 |
-
|
|
|
|
|
|
|
10 |
public function setProductCollection($collection){
|
11 |
$this->_productCollection = $collection;
|
12 |
}
|
@@ -24,6 +27,80 @@ class Magestore_Facebook_Model_Export extends Mage_Core_Model_Abstract
|
|
24 |
return $this->_product;
|
25 |
}
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
public function _construct()
|
28 |
{
|
29 |
parent::_construct();
|
@@ -38,15 +115,33 @@ class Magestore_Facebook_Model_Export extends Mage_Core_Model_Abstract
|
|
38 |
$this->_element->formatOutput = true;
|
39 |
$this->_simplerss = $this->_element->createElement('products');
|
40 |
}
|
41 |
-
public function
|
42 |
-
$this->
|
43 |
-
$
|
44 |
-
$
|
45 |
-
|
46 |
-
|
47 |
-
$
|
48 |
-
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
protected function addToXML($entryData){
|
51 |
$dom = $this->getDom();
|
52 |
$item = $dom->createElement('item');
|
@@ -75,12 +170,12 @@ class Magestore_Facebook_Model_Export extends Mage_Core_Model_Abstract
|
|
75 |
$baseUrl = Mage::helper('facebook')->refineUrl(Mage::getBaseUrl());
|
76 |
$baseUrl = str_replace("index.php/","",$baseUrl);
|
77 |
if($_product->getThumbnail() !=''){
|
78 |
-
$imagePath = Mage::helper('catalog/image')->init($_product, 'image')->resize(
|
79 |
}
|
80 |
$data = array(
|
81 |
-
'name'
|
82 |
'image' =>$imagePath,
|
83 |
-
'short_description'
|
84 |
'id'=>$_product->getId(),
|
85 |
'link' =>$_product->getProductUrl(),
|
86 |
'price'=>$this->get_product_price($_product)
|
@@ -88,6 +183,9 @@ class Magestore_Facebook_Model_Export extends Mage_Core_Model_Abstract
|
|
88 |
$this->addToXML($data);
|
89 |
}
|
90 |
}
|
|
|
|
|
|
|
91 |
return $this->saveXML();
|
92 |
}
|
93 |
|
@@ -121,10 +219,10 @@ class Magestore_Facebook_Model_Export extends Mage_Core_Model_Abstract
|
|
121 |
$imagePath = Mage::helper('catalog/image')->init($_product, 'image')->resize(200);
|
122 |
}
|
123 |
$data = array(
|
124 |
-
'name'
|
125 |
'image' =>$imagePath,
|
126 |
-
'short_description'
|
127 |
-
'description'
|
128 |
'id'=>$_product->getId(),
|
129 |
'link' =>$_product->getProductUrl(),
|
130 |
'price'=>$this->get_product_price($_product)
|
@@ -138,7 +236,7 @@ class Magestore_Facebook_Model_Export extends Mage_Core_Model_Abstract
|
|
138 |
|
139 |
function clean_url($text)
|
140 |
{
|
141 |
-
|
142 |
$code_entities_match = array('®','@');
|
143 |
$code_entities_replace = array(' ',' ');
|
144 |
$text = str_replace($code_entities_match, $code_entities_replace, $text);
|
@@ -155,23 +253,63 @@ class Magestore_Facebook_Model_Export extends Mage_Core_Model_Abstract
|
|
155 |
|
156 |
return $_coreHelper->currency($_finalPrice,true,false);
|
157 |
}
|
158 |
-
|
|
|
|
|
|
|
|
|
159 |
public function exportAllCategoryToXML(){
|
160 |
$this->initDom();
|
161 |
$_categoryCollection = $this->getProductCollection();
|
162 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
if (count($_categoryCollection)>0) {
|
164 |
foreach ($_categoryCollection as $_category) {
|
165 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
$data = array(
|
167 |
-
'name'
|
168 |
'id'=>$_category->getEntityId(),
|
169 |
'link' =>$_category->getUrl(),
|
|
|
|
|
170 |
'product_count'=>$_category->getProductCount()
|
171 |
-
|
172 |
$this->addToXML($data);
|
173 |
}
|
174 |
}
|
175 |
return $this->saveXML();
|
176 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
177 |
}
|
6 |
protected $_simplerss;
|
7 |
protected $_productCollection;
|
8 |
protected $_product;
|
9 |
+
protected $_totalRecord = -1;
|
10 |
+
protected $_totalPage;
|
11 |
+
protected $_currentPage =1;
|
12 |
+
protected $_product_limit ;
|
13 |
public function setProductCollection($collection){
|
14 |
$this->_productCollection = $collection;
|
15 |
}
|
27 |
return $this->_product;
|
28 |
}
|
29 |
|
30 |
+
public function exportTotalProduct($total){
|
31 |
+
$this->initDom();
|
32 |
+
$parentElement = $this->getDom();
|
33 |
+
$totalProductElement = $parentElement->createElement('total',$total);
|
34 |
+
$parentElement->appendChild($totalProductElement);
|
35 |
+
$this->_simplerss->appendChild($parentElement);
|
36 |
+
$dom = $this->_element;
|
37 |
+
return $dom->saveXML();
|
38 |
+
}
|
39 |
+
public function exportProductDetail(){
|
40 |
+
$this->initDom();
|
41 |
+
$_product = $this->_product;
|
42 |
+
$name = htmlspecialchars($_product->getName());
|
43 |
+
$shortDescription = htmlspecialchars($_product->getDescription());
|
44 |
+
$price = $this->get_product_price($_product);
|
45 |
+
$image = Mage::helper('catalog/image')->init($_product, 'image')->resize(400);
|
46 |
+
$dom = $this->getDom();
|
47 |
+
|
48 |
+
$productDetail = $dom->createElement('product');
|
49 |
+
$priceElement = $dom->createElement('price',htmlspecialchars($price));
|
50 |
+
$nameElement = $dom->createElement('name',htmlspecialchars($name));
|
51 |
+
$linkElement = $dom->createElement('link',$_product->getProductUrl());
|
52 |
+
$shortDescriptionElement = $dom->createElement('short_description',htmlspecialchars($shortDescription));
|
53 |
+
$imageElement = $dom->createElement('image',htmlspecialchars($image));
|
54 |
+
$productIdElement = $dom->createElement('product_id',$_product->getId());
|
55 |
+
$productDetail->appendChild($priceElement);
|
56 |
+
$productDetail->appendChild($nameElement);
|
57 |
+
$productDetail->appendChild($linkElement);
|
58 |
+
$productDetail->appendChild($shortDescriptionElement);
|
59 |
+
$productDetail->appendChild($imageElement);
|
60 |
+
$productDetail->appendChild($productIdElement);
|
61 |
+
$galleryCollection = $_product->getMediaGalleryImages();
|
62 |
+
foreach($galleryCollection as $_image){
|
63 |
+
$image = Mage::helper('catalog/image')->init($_product, 'image',$_image->getFile())->resize(400);
|
64 |
+
$valueElement = $dom->createElement('value',$image);
|
65 |
+
$thumb = Mage::helper('catalog/image')->init($_product, 'image',$_image->getFile())->resize(80);
|
66 |
+
|
67 |
+
$thumbElement = $dom->createElement('thumbnail',$thumb);
|
68 |
+
$moreViewElement = $dom->createElement('images');
|
69 |
+
$moreViewElement->appendChild($valueElement);
|
70 |
+
$moreViewElement->appendChild($thumbElement);
|
71 |
+
$productDetail->appendChild($moreViewElement);
|
72 |
+
}
|
73 |
+
|
74 |
+
$_options = Mage::helper('core')->decorateArray($_product->getOptions());
|
75 |
+
if(count($_options)){
|
76 |
+
$optionList = $dom->createElement('options');
|
77 |
+
foreach($_options as $_option){
|
78 |
+
$optionElement = $dom->createElement('option');
|
79 |
+
foreach($_option->getData() as $key=>$value){
|
80 |
+
$_element = $dom->createElement($key,$value);
|
81 |
+
$optionElement->appendChild($_element);
|
82 |
+
}
|
83 |
+
$values = $_option->getValues();
|
84 |
+
$valueList = $dom->createElement('values');
|
85 |
+
foreach($values as $_value){
|
86 |
+
$valueElement = $dom->createElement('value');
|
87 |
+
foreach($_value->getData() as $key=>$value){
|
88 |
+
$_element = $dom->createElement($key,$value);
|
89 |
+
$valueElement->appendChild($_element);
|
90 |
+
}
|
91 |
+
$valueList->appendChild($valueElement);
|
92 |
+
}
|
93 |
+
$optionElement->appendChild($valueList);
|
94 |
+
$optionList->appendChild($optionElement);
|
95 |
+
}
|
96 |
+
$productDetail->appendChild($optionList);
|
97 |
+
}
|
98 |
+
|
99 |
+
$this->_simplerss->appendChild($productDetail);
|
100 |
+
$dom = $this->_element;
|
101 |
+
$dom->appendChild($this->_simplerss);
|
102 |
+
return $dom->saveXML();
|
103 |
+
}
|
104 |
public function _construct()
|
105 |
{
|
106 |
parent::_construct();
|
115 |
$this->_element->formatOutput = true;
|
116 |
$this->_simplerss = $this->_element->createElement('products');
|
117 |
}
|
118 |
+
public function iniStoreXML(){
|
119 |
+
$this->_element = new DOMDocument('1.0','utf-8');
|
120 |
+
$this->_element->formatOutput = true;
|
121 |
+
$this->_simplerss = $this->_element->createElement('stores');
|
122 |
+
}
|
123 |
+
public function setPaginatorInfo($totalRecord,$totalPage,$currentPage,$product_limit){
|
124 |
+
$this->_totalRecord =$totalRecord;
|
125 |
+
$this->_totalPage = $totalPage;
|
126 |
+
$this->_currentPage = $currentPage;
|
127 |
+
$this->_product_limit = $product_limit;
|
128 |
+
}
|
129 |
+
protected function addPaginator(){
|
130 |
+
$dom = $this->getDom();
|
131 |
+
|
132 |
+
$item = $dom->createElement('paginator');
|
133 |
+
|
134 |
+
$totalElement = $dom->createElement('total_record',$this->_totalRecord);
|
135 |
+
$item->appendChild($totalElement);
|
136 |
+
$pageElement = $dom->createElement('total_page',$this->_totalPage);
|
137 |
+
$item->appendChild($pageElement);
|
138 |
+
$curPageElement = $dom->createElement('current_page',$this->_currentPage);
|
139 |
+
$item->appendChild($curPageElement);
|
140 |
+
$productLimit = $dom->createElement('product_limit',$this->_product_limit);
|
141 |
+
$item->appendChild($productLimit);
|
142 |
+
$this->_simplerss->appendChild($item);
|
143 |
+
|
144 |
+
}
|
145 |
protected function addToXML($entryData){
|
146 |
$dom = $this->getDom();
|
147 |
$item = $dom->createElement('item');
|
170 |
$baseUrl = Mage::helper('facebook')->refineUrl(Mage::getBaseUrl());
|
171 |
$baseUrl = str_replace("index.php/","",$baseUrl);
|
172 |
if($_product->getThumbnail() !=''){
|
173 |
+
$imagePath = Mage::helper('catalog/image')->init($_product, 'image')->resize(144);
|
174 |
}
|
175 |
$data = array(
|
176 |
+
'name'=>htmlspecialchars($_product->getName()),
|
177 |
'image' =>$imagePath,
|
178 |
+
'short_description'=>htmlspecialchars($_product->getShortDescription()),
|
179 |
'id'=>$_product->getId(),
|
180 |
'link' =>$_product->getProductUrl(),
|
181 |
'price'=>$this->get_product_price($_product)
|
183 |
$this->addToXML($data);
|
184 |
}
|
185 |
}
|
186 |
+
if($this->_totalRecord !=-1){
|
187 |
+
$this->addPaginator();
|
188 |
+
}
|
189 |
return $this->saveXML();
|
190 |
}
|
191 |
|
219 |
$imagePath = Mage::helper('catalog/image')->init($_product, 'image')->resize(200);
|
220 |
}
|
221 |
$data = array(
|
222 |
+
'name'=>htmlspecialchars($_product->getName()),
|
223 |
'image' =>$imagePath,
|
224 |
+
'short_description'=>htmlspecialchars($_product->getShortDescription()),
|
225 |
+
'description'=>htmlspecialchars($_product->getDescription()),
|
226 |
'id'=>$_product->getId(),
|
227 |
'link' =>$_product->getProductUrl(),
|
228 |
'price'=>$this->get_product_price($_product)
|
236 |
|
237 |
function clean_url($text)
|
238 |
{
|
239 |
+
//$text=strtolower($text);
|
240 |
$code_entities_match = array('®','@');
|
241 |
$code_entities_replace = array(' ',' ');
|
242 |
$text = str_replace($code_entities_match, $code_entities_replace, $text);
|
253 |
|
254 |
return $_coreHelper->currency($_finalPrice,true,false);
|
255 |
}
|
256 |
+
public function exportDataToXML($data){
|
257 |
+
$this->initDom();
|
258 |
+
$this->addToXML($data);
|
259 |
+
return $this->saveXML();
|
260 |
+
}
|
261 |
public function exportAllCategoryToXML(){
|
262 |
$this->initDom();
|
263 |
$_categoryCollection = $this->getProductCollection();
|
264 |
+
$hide_categories = Mage::getStoreConfig('facebook/general/hide_categories');
|
265 |
+
$hideCategoryIds = array();
|
266 |
+
if($hide_categories !=''){
|
267 |
+
$hide_categories = explode(',',$hide_categories);
|
268 |
+
if(is_array($hide_categories) && count($hide_categories)>0){
|
269 |
+
foreach($hide_categories as $key=>$value){
|
270 |
+
$category = Mage::getModel('catalog/category')
|
271 |
+
->load($value);
|
272 |
+
if($category->getId()){
|
273 |
+
$hideCategoryIds[] = $category->getId();
|
274 |
+
}
|
275 |
+
}
|
276 |
+
}
|
277 |
+
}
|
278 |
if (count($_categoryCollection)>0) {
|
279 |
foreach ($_categoryCollection as $_category) {
|
280 |
+
if(!empty($hideCategoryIds)){
|
281 |
+
if(in_array($_category->getId(),$hideCategoryIds)){
|
282 |
+
continue;
|
283 |
+
}
|
284 |
+
if(in_array($_category->getParentId(),$hideCategoryIds)){
|
285 |
+
continue;
|
286 |
+
}
|
287 |
+
}
|
288 |
$data = array(
|
289 |
+
'name'=>htmlspecialchars($_category->getName()),
|
290 |
'id'=>$_category->getEntityId(),
|
291 |
'link' =>$_category->getUrl(),
|
292 |
+
'parent_id'=>$_category->getParentId(),
|
293 |
+
'level'=>$_category->getLevel(),
|
294 |
'product_count'=>$_category->getProductCount()
|
295 |
+
);
|
296 |
$this->addToXML($data);
|
297 |
}
|
298 |
}
|
299 |
return $this->saveXML();
|
300 |
}
|
301 |
+
public function exportStores($collection){
|
302 |
+
$this->iniStoreXML();
|
303 |
+
if($collection->getSize()>0){
|
304 |
+
foreach($collection as $_store){
|
305 |
+
$data = array(
|
306 |
+
'store_id' =>$_store->getId(),
|
307 |
+
'store_name' =>$_store->getName(),
|
308 |
+
);
|
309 |
+
$this->addToXML($data);
|
310 |
+
}
|
311 |
+
|
312 |
+
}
|
313 |
+
return $this->saveXML();
|
314 |
+
}
|
315 |
}
|
app/code/local/Magestore/Facebook/controllers/IndexController.php
CHANGED
@@ -4,20 +4,47 @@ class Magestore_Facebook_IndexController extends Mage_Core_Controller_Front_Acti
|
|
4 |
public function indexAction()
|
5 |
{
|
6 |
$product_limit = Mage::getStoreConfig('facebook/general/product_limit');
|
7 |
-
|
8 |
$keyword = $this->getRequest()->getParam('keyword');
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
10 |
$collection = Mage::getModel("catalog/product")->getCollection()
|
11 |
->addAttributeToSelect("*")
|
12 |
-
|
13 |
->addFieldToFilter("status",1)
|
14 |
-
->setCurPage(1)
|
15 |
-
->setPageSize($product_limit)
|
16 |
->setOrder('updated_at','DESC')
|
17 |
;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
$export = Mage::getModel("facebook/export");
|
20 |
$export->setProductCollection($collection);
|
|
|
21 |
echo $export->exportToXML();
|
22 |
}
|
23 |
public function countAction(){
|
@@ -25,7 +52,15 @@ class Magestore_Facebook_IndexController extends Mage_Core_Controller_Front_Acti
|
|
25 |
->addFieldToFilter('status',1);
|
26 |
$export = Mage::getModel("facebook/export");
|
27 |
echo $export->exportTotalProduct($collection->getSize());
|
28 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
public function productAction()
|
30 |
{
|
31 |
$id = $this->getRequest()->getParam('id');
|
@@ -56,7 +91,37 @@ class Magestore_Facebook_IndexController extends Mage_Core_Controller_Front_Acti
|
|
56 |
$export->setProductCollection($collection);
|
57 |
echo $export->exportAllProductToXML();
|
58 |
}
|
59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
|
61 |
public function clean_url($text)
|
62 |
{
|
@@ -81,5 +146,12 @@ class Magestore_Facebook_IndexController extends Mage_Core_Controller_Front_Acti
|
|
81 |
$export->setProductCollection($collection);
|
82 |
echo $export->exportAllCategoryToXML();
|
83 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
|
85 |
}
|
4 |
public function indexAction()
|
5 |
{
|
6 |
$product_limit = Mage::getStoreConfig('facebook/general/product_limit');
|
|
|
7 |
$keyword = $this->getRequest()->getParam('keyword');
|
8 |
+
$category = $this->getRequest()->getParam('category');
|
9 |
+
$curPage = $this->getRequest()->getParam('page');
|
10 |
+
$store_id = $this->getRequest()->getParam('store_id','');
|
11 |
+
if((!$curPage)||($curPage == 0)){
|
12 |
+
$curPage = 1;
|
13 |
+
}
|
14 |
$collection = Mage::getModel("catalog/product")->getCollection()
|
15 |
->addAttributeToSelect("*")
|
16 |
+
//->addFieldToFilter("name",array('like'=>'%'.$this->clean_url($keyword).'%'))
|
17 |
->addFieldToFilter("status",1)
|
|
|
|
|
18 |
->setOrder('updated_at','DESC')
|
19 |
;
|
20 |
+
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
|
21 |
+
Mage::getSingleton('catalog/product_visibility')->addVisibleInSiteFilterToCollection($collection);
|
22 |
+
if($category !='all'){
|
23 |
+
$cat = Mage::getModel('catalog/category')
|
24 |
+
->load($category);
|
25 |
+
if($cat->getId()){
|
26 |
+
$collection->addCategoryFilter($cat);
|
27 |
+
}
|
28 |
+
}
|
29 |
+
if($keyword !=''){
|
30 |
+
$collection->addFieldToFilter("name",array('like'=>'%'.$this->clean_url($keyword).'%'));
|
31 |
+
}
|
32 |
+
|
33 |
+
if($store_id !=''){
|
34 |
+
$currentStore = Mage::app()->getStore()->load($store_id);
|
35 |
+
if($currentStore->getId()){
|
36 |
+
$collection->setStore($currentStore);
|
37 |
+
}
|
38 |
+
|
39 |
+
}
|
40 |
+
$totalRecord =$collection->getSize();
|
41 |
+
$totalPage = round((int)$totalRecord/(int)$product_limit)+1;
|
42 |
+
$collection->setCurPage($curPage);
|
43 |
+
$collection->setPageSize($product_limit);
|
44 |
|
45 |
$export = Mage::getModel("facebook/export");
|
46 |
$export->setProductCollection($collection);
|
47 |
+
$export->setPaginatorInfo($totalRecord,$totalPage,$curPage,$product_limit);
|
48 |
echo $export->exportToXML();
|
49 |
}
|
50 |
public function countAction(){
|
52 |
->addFieldToFilter('status',1);
|
53 |
$export = Mage::getModel("facebook/export");
|
54 |
echo $export->exportTotalProduct($collection->getSize());
|
55 |
+
}
|
56 |
+
public function viewAction(){
|
57 |
+
$productId = $this->getRequest()->getParam('product');
|
58 |
+
$product = Mage::getModel('catalog/product')->load($productId);
|
59 |
+
$export = Mage::getModel('facebook/export');
|
60 |
+
$export->setProduct($product);
|
61 |
+
$collectionImage = $product->getMediaGalleryImages();
|
62 |
+
echo $export->exportProductDetail();
|
63 |
+
}
|
64 |
public function productAction()
|
65 |
{
|
66 |
$id = $this->getRequest()->getParam('id');
|
91 |
$export->setProductCollection($collection);
|
92 |
echo $export->exportAllProductToXML();
|
93 |
}
|
94 |
+
public function _addProductAttributesAndPrices(Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection)
|
95 |
+
{
|
96 |
+
return $collection
|
97 |
+
->addMinimalPrice()
|
98 |
+
->addFinalPrice()
|
99 |
+
->addTaxPercents()
|
100 |
+
->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes());
|
101 |
+
}
|
102 |
+
|
103 |
+
public function newproductAction(){
|
104 |
+
$todayDate = Mage::app()->getLocale()->date()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
|
105 |
+
|
106 |
+
$collection = Mage::getResourceModel('catalog/product_collection');
|
107 |
+
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
|
108 |
+
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
|
109 |
+
|
110 |
+
$collection->addStoreFilter()
|
111 |
+
->addAttributeToSelect("*")
|
112 |
+
->addAttributeToFilter('news_from_date', array('date' => true, 'to' => $todayDate))
|
113 |
+
->addAttributeToFilter('news_to_date', array('or'=> array(
|
114 |
+
0 => array('date' => true, 'from' => $todayDate),
|
115 |
+
1 => array('is' => new Zend_Db_Expr('null')))
|
116 |
+
), 'left')
|
117 |
+
->addAttributeToSort('news_from_date', 'desc')
|
118 |
+
->setPageSize(10)
|
119 |
+
->setCurPage(1)
|
120 |
+
;
|
121 |
+
$export = Mage::getModel("facebook/export");
|
122 |
+
$export->setProductCollection($collection);
|
123 |
+
echo $export->exportToXML();
|
124 |
+
}
|
125 |
|
126 |
public function clean_url($text)
|
127 |
{
|
146 |
$export->setProductCollection($collection);
|
147 |
echo $export->exportAllCategoryToXML();
|
148 |
}
|
149 |
+
|
150 |
+
public function storeAction(){
|
151 |
+
$collection = Mage::app()->getStore()->getCollection();
|
152 |
+
$export = Mage::getModel('facebook/export');
|
153 |
+
$xmlOutput = $export->exportStores($collection);
|
154 |
+
print($xmlOutput);
|
155 |
+
}
|
156 |
|
157 |
}
|
app/code/local/Magestore/Facebook/etc/config.xml
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
</default>
|
10 |
<modules>
|
11 |
<Magestore_Facebook>
|
12 |
-
<version>0.1.
|
13 |
</Magestore_Facebook>
|
14 |
</modules>
|
15 |
<frontend>
|
@@ -18,7 +18,7 @@
|
|
18 |
<use>standard</use>
|
19 |
<args>
|
20 |
<module>Magestore_Facebook</module>
|
21 |
-
<frontName>
|
22 |
</args>
|
23 |
</facebook>
|
24 |
</routers>
|
@@ -36,15 +36,15 @@
|
|
36 |
<use>admin</use>
|
37 |
<args>
|
38 |
<module>Magestore_Facebook</module>
|
39 |
-
<frontName>
|
40 |
</args>
|
41 |
</facebook>
|
42 |
</routers>
|
43 |
</admin>
|
44 |
<adminhtml>
|
45 |
<menu>
|
46 |
-
<
|
47 |
-
<title>
|
48 |
<sort_order>71</sort_order>
|
49 |
<children>
|
50 |
<settings module="facebook">
|
@@ -53,7 +53,7 @@
|
|
53 |
<action>adminhtml/system_config/edit/section/facebook</action>
|
54 |
</settings>
|
55 |
</children>
|
56 |
-
</
|
57 |
</menu>
|
58 |
<acl>
|
59 |
<resources>
|
9 |
</default>
|
10 |
<modules>
|
11 |
<Magestore_Facebook>
|
12 |
+
<version>0.1.2</version>
|
13 |
</Magestore_Facebook>
|
14 |
</modules>
|
15 |
<frontend>
|
18 |
<use>standard</use>
|
19 |
<args>
|
20 |
<module>Magestore_Facebook</module>
|
21 |
+
<frontName>facebookstore</frontName>
|
22 |
</args>
|
23 |
</facebook>
|
24 |
</routers>
|
36 |
<use>admin</use>
|
37 |
<args>
|
38 |
<module>Magestore_Facebook</module>
|
39 |
+
<frontName>facebookstore</frontName>
|
40 |
</args>
|
41 |
</facebook>
|
42 |
</routers>
|
43 |
</admin>
|
44 |
<adminhtml>
|
45 |
<menu>
|
46 |
+
<facebook module="facebook">
|
47 |
+
<title>Facebook Application</title>
|
48 |
<sort_order>71</sort_order>
|
49 |
<children>
|
50 |
<settings module="facebook">
|
53 |
<action>adminhtml/system_config/edit/section/facebook</action>
|
54 |
</settings>
|
55 |
</children>
|
56 |
+
</facebook>
|
57 |
</menu>
|
58 |
<acl>
|
59 |
<resources>
|
app/code/local/Magestore/Facebook/etc/system.xml
CHANGED
@@ -32,17 +32,18 @@
|
|
32 |
<show_in_default>1</show_in_default>
|
33 |
<show_in_website>1</show_in_website>
|
34 |
<show_in_store>1</show_in_store>
|
35 |
-
<comment
|
36 |
</product_limit>
|
37 |
<app_name translate="label">
|
38 |
-
<label>Application
|
39 |
<frontend_type>text</frontend_type>
|
40 |
<sort_order>1</sort_order>
|
41 |
<show_in_default>1</show_in_default>
|
42 |
<show_in_website>1</show_in_website>
|
43 |
<show_in_store>1</show_in_store>
|
44 |
-
<comment
|
45 |
</app_name>
|
|
|
46 |
<store_name translate="label">
|
47 |
<label>Store Name</label>
|
48 |
<frontend_type>text</frontend_type>
|
@@ -50,8 +51,7 @@
|
|
50 |
<show_in_default>1</show_in_default>
|
51 |
<show_in_website>1</show_in_website>
|
52 |
<show_in_store>1</show_in_store>
|
53 |
-
|
54 |
-
</store_name>
|
55 |
<category translate="label">
|
56 |
<label>Store Category</label>
|
57 |
<frontend_type>select</frontend_type>
|
@@ -60,7 +60,16 @@
|
|
60 |
<show_in_default>1</show_in_default>
|
61 |
<show_in_website>1</show_in_website>
|
62 |
<show_in_store>1</show_in_store>
|
63 |
-
</category>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
<contact_name translate="label">
|
65 |
<label>Contact Name</label>
|
66 |
<frontend_type>text</frontend_type>
|
@@ -76,7 +85,6 @@
|
|
76 |
<show_in_default>1</show_in_default>
|
77 |
<show_in_website>1</show_in_website>
|
78 |
<show_in_store>1</show_in_store>
|
79 |
-
<comment><![CDATA[<font color="red">This is a required field</font>]]></comment>
|
80 |
</contact_email>
|
81 |
<contact_phone translate="label">
|
82 |
<label>Contact Phone</label>
|
@@ -101,7 +109,6 @@
|
|
101 |
<show_in_default>1</show_in_default>
|
102 |
<show_in_website>1</show_in_website>
|
103 |
<show_in_store>1</show_in_store>
|
104 |
-
<comment><![CDATA[Example : <i>http://www.yourdomain.com/skin/frontend/default/default/images/logo.gif</i><br/><font color="red">This is a required field</font>]]></comment>
|
105 |
</logo_link>
|
106 |
<description translate="label">
|
107 |
<label>Description</label>
|
@@ -110,11 +117,6 @@
|
|
110 |
<show_in_default>1</show_in_default>
|
111 |
<show_in_website>1</show_in_website>
|
112 |
<show_in_store>1</show_in_store>
|
113 |
-
<comment><![CDATA[
|
114 |
-
Please note, We require a short description about your store<br/>
|
115 |
-
<font color="red">This is a required field</font><br/><br/>
|
116 |
-
]]>
|
117 |
-
</comment>
|
118 |
</description>
|
119 |
|
120 |
</fields>
|
32 |
<show_in_default>1</show_in_default>
|
33 |
<show_in_website>1</show_in_website>
|
34 |
<show_in_store>1</show_in_store>
|
35 |
+
<comment>The maximum number of product show on search page</comment>
|
36 |
</product_limit>
|
37 |
<app_name translate="label">
|
38 |
+
<label>Application Name</label>
|
39 |
<frontend_type>text</frontend_type>
|
40 |
<sort_order>1</sort_order>
|
41 |
<show_in_default>1</show_in_default>
|
42 |
<show_in_website>1</show_in_website>
|
43 |
<show_in_store>1</show_in_store>
|
44 |
+
<comment>The name of your own Facebook application</comment>
|
45 |
</app_name>
|
46 |
+
|
47 |
<store_name translate="label">
|
48 |
<label>Store Name</label>
|
49 |
<frontend_type>text</frontend_type>
|
51 |
<show_in_default>1</show_in_default>
|
52 |
<show_in_website>1</show_in_website>
|
53 |
<show_in_store>1</show_in_store>
|
54 |
+
</store_name>
|
|
|
55 |
<category translate="label">
|
56 |
<label>Store Category</label>
|
57 |
<frontend_type>select</frontend_type>
|
60 |
<show_in_default>1</show_in_default>
|
61 |
<show_in_website>1</show_in_website>
|
62 |
<show_in_store>1</show_in_store>
|
63 |
+
</category>
|
64 |
+
<hide_categories>
|
65 |
+
<label>Hide Categories</label>
|
66 |
+
<frontend_type>text</frontend_type>
|
67 |
+
<sort_order>2</sort_order>
|
68 |
+
<show_in_default>1</show_in_default>
|
69 |
+
<show_in_website>1</show_in_website>
|
70 |
+
<show_in_store>1</show_in_store>
|
71 |
+
<comment>Ids of categories need to hide, example : 10,13,15</comment>
|
72 |
+
</hide_categories>
|
73 |
<contact_name translate="label">
|
74 |
<label>Contact Name</label>
|
75 |
<frontend_type>text</frontend_type>
|
85 |
<show_in_default>1</show_in_default>
|
86 |
<show_in_website>1</show_in_website>
|
87 |
<show_in_store>1</show_in_store>
|
|
|
88 |
</contact_email>
|
89 |
<contact_phone translate="label">
|
90 |
<label>Contact Phone</label>
|
109 |
<show_in_default>1</show_in_default>
|
110 |
<show_in_website>1</show_in_website>
|
111 |
<show_in_store>1</show_in_store>
|
|
|
112 |
</logo_link>
|
113 |
<description translate="label">
|
114 |
<label>Description</label>
|
117 |
<show_in_default>1</show_in_default>
|
118 |
<show_in_website>1</show_in_website>
|
119 |
<show_in_store>1</show_in_store>
|
|
|
|
|
|
|
|
|
|
|
120 |
</description>
|
121 |
|
122 |
</fields>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>FacebookProductDirectoryCommunity</name>
|
4 |
-
<version>0.1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">Extension license name (OSL v3.0)</license>
|
7 |
<channel>community</channel>
|
@@ -12,9 +12,9 @@ copy of your Magento store into Facebook. All the information from your store ca
|
|
12 |
Facebook in real time.</description>
|
13 |
<notes>Free Version</notes>
|
14 |
<authors><author><name>Magestore</name><user>auto-converted</user><email>magestore@gmail.com</email></author></authors>
|
15 |
-
<date>2010-
|
16 |
-
<time>
|
17 |
-
<contents><target name="magelocal"><dir name="Magestore"><dir name="Facebook"><dir name="Block"><file name="Facebook.php" hash="f686c270ec8762008e41dbd8fdfbcb72"/><dir name="Adminhtml"><file name="Facebook.php" hash="27b9451e2951dbab34817a0570bbb3b8"/><dir name="Facebook"><file name="Edit.php" hash="39be311cccaa58c9fef1fecff8b0097f"/><file name="Grid.php" hash="b0f8d0850f4e9c32ec5159e974008bfb"/><dir name="Edit"><file name="Form.php" hash="5ac91f35df9a73e6475a867a301e66d0"/><file name="Tabs.php" hash="b2e8c09989aa46e8eee4d521884586b2"/><dir name="Tab"><file name="Form.php" hash="705386c1f07ddce7b520427f5c5f0ee3"/></dir></dir></dir></dir></dir><dir name="controllers"><file name="IndexController.php" hash="
|
18 |
<compatible/>
|
19 |
<dependencies/>
|
20 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>FacebookProductDirectoryCommunity</name>
|
4 |
+
<version>0.1.4</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">Extension license name (OSL v3.0)</license>
|
7 |
<channel>community</channel>
|
12 |
Facebook in real time.</description>
|
13 |
<notes>Free Version</notes>
|
14 |
<authors><author><name>Magestore</name><user>auto-converted</user><email>magestore@gmail.com</email></author></authors>
|
15 |
+
<date>2010-04-29</date>
|
16 |
+
<time>09:56:25</time>
|
17 |
+
<contents><target name="magelocal"><dir name="Magestore"><dir name="Facebook"><dir name="Block"><file name="Facebook.php" hash="f686c270ec8762008e41dbd8fdfbcb72"/><dir name="Adminhtml"><file name="Facebook.php" hash="27b9451e2951dbab34817a0570bbb3b8"/><dir name="Facebook"><file name="Edit.php" hash="39be311cccaa58c9fef1fecff8b0097f"/><file name="Grid.php" hash="b0f8d0850f4e9c32ec5159e974008bfb"/><dir name="Edit"><file name="Form.php" hash="5ac91f35df9a73e6475a867a301e66d0"/><file name="Tabs.php" hash="b2e8c09989aa46e8eee4d521884586b2"/><dir name="Tab"><file name="Form.php" hash="705386c1f07ddce7b520427f5c5f0ee3"/></dir></dir></dir></dir></dir><dir name="controllers"><file name="IndexController.php" hash="0064c62fa39596072c60daa09c5064fe"/><dir name="Adminhtml"><file name="FacebookController.php" hash="a4c4d8b4accdad6b0481c4ec148ff51c"/></dir></dir><dir name="etc"><file name="config.xml" hash="ac58294b4fd3d66975e283fe1c4594a3"/><file name="system.xml" hash="8160ce7fb191611df73932edd1496aee"/></dir><dir name="Helper"><file name="Data.php" hash="8ac492774d5c171f27095b3708419332"/></dir><dir name="Model"><file name="Category.php" hash="64f32d91bdfa5d9adfa78adbe73967c3"/><file name="Export.php" hash="c40f29345b96ac759d54b6046cea9924"/><file name="Facebook.php" hash="8a6d78f1ddd525c02f87d6f0bc274b88"/><file name="Status.php" hash="a1deedfb19fb208291cc1f33bb647175"/><dir name="Mysql4"><file name="Facebook.php" hash="c7043bb1b16ccd3b6bfaf42b1d9ca10a"/><dir name="Facebook"><file name="Collection.php" hash="1ebdd1537327340d6e355ca05f739a50"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Magestore_Facebook.xml" hash="2af9340c3f8af07cc2201decbf432685"/></dir></target></contents>
|
18 |
<compatible/>
|
19 |
<dependencies/>
|
20 |
</package>
|