Version Notes
Magmodules_Sooqr
Download this release
Release Info
| Developer | Magmodules |
| Extension | Magmodules_Sooqr |
| Version | 1.1.4 |
| Comparing to | |
| See all releases | |
Code changes from version 1.1.1 to 1.1.4
- app/code/community/Magmodules/Sooqr/Block/Adminhtml/Widget/Info/Info.php +7 -4
- app/code/community/Magmodules/Sooqr/Helper/Data.php +70 -24
- app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Image.php +29 -0
- app/code/community/Magmodules/Sooqr/Model/Common.php +2 -1
- app/code/community/Magmodules/Sooqr/Model/Sooqr.php +32 -22
- app/code/community/Magmodules/Sooqr/controllers/Adminhtml/SooqrController.php +1 -1
- app/code/community/Magmodules/Sooqr/etc/adminhtml.xml +1 -12
- app/code/community/Magmodules/Sooqr/etc/config.xml +1 -1
- package.xml +6 -6
app/code/community/Magmodules/Sooqr/Block/Adminhtml/Widget/Info/Info.php
CHANGED
|
@@ -22,8 +22,9 @@ class Magmodules_Sooqr_Block_Adminhtml_Widget_Info_Info extends Mage_Adminhtml_B
|
|
| 22 |
$account_id = Mage::getStoreConfig('sooqr_connect/general/account_id');
|
| 23 |
$api_key = Mage::getStoreConfig('sooqr_connect/general/api_key');
|
| 24 |
$magento_version = Mage::getVersion();
|
| 25 |
-
$module_version = Mage::getConfig()->getNode()->modules->
|
| 26 |
$logo_link = '//www.magmodules.eu/logo/sooqr/' . $module_version . '/' . $magento_version . '/logo.png';
|
|
|
|
| 27 |
|
| 28 |
$html = '<div style="background:url(\'' . $logo_link . '\') no-repeat scroll 15px center #EAF0EE;border:1px solid #CCCCCC;margin-bottom:10px;padding:10px 5px 5px 200px;">
|
| 29 |
<h4>About Magmodules.eu</h4>
|
|
@@ -46,9 +47,11 @@ class Magmodules_Sooqr_Block_Adminhtml_Widget_Info_Info extends Mage_Adminhtml_B
|
|
| 46 |
if(empty($account_id) && empty($api_key)) {
|
| 47 |
$html .= ' <tr>
|
| 48 |
<td>Registration on Sooqr (and free trial):</td>
|
| 49 |
-
<td><a href="https://my.sooqr.com/magtrial" target="_blank">Register here</a></td>
|
| 50 |
-
</tr>
|
| 51 |
-
|
|
|
|
|
|
|
| 52 |
<td>Sooqr Conversion Suite</td>
|
| 53 |
<td><a href="https://my.sooqr.com/user/login" target="_blank">Login here</a></td>
|
| 54 |
</tr>';
|
| 22 |
$account_id = Mage::getStoreConfig('sooqr_connect/general/account_id');
|
| 23 |
$api_key = Mage::getStoreConfig('sooqr_connect/general/api_key');
|
| 24 |
$magento_version = Mage::getVersion();
|
| 25 |
+
$module_version = Mage::getConfig()->getNode()->modules->Magmodules_Sooqr->version;
|
| 26 |
$logo_link = '//www.magmodules.eu/logo/sooqr/' . $module_version . '/' . $magento_version . '/logo.png';
|
| 27 |
+
$base_url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
| 28 |
|
| 29 |
$html = '<div style="background:url(\'' . $logo_link . '\') no-repeat scroll 15px center #EAF0EE;border:1px solid #CCCCCC;margin-bottom:10px;padding:10px 5px 5px 200px;">
|
| 30 |
<h4>About Magmodules.eu</h4>
|
| 47 |
if(empty($account_id) && empty($api_key)) {
|
| 48 |
$html .= ' <tr>
|
| 49 |
<td>Registration on Sooqr (and free trial):</td>
|
| 50 |
+
<td><a href="https://my.sooqr.com/magtrial?base=' . $base_url . '" target="_blank">Register here</a></td>
|
| 51 |
+
</tr>';
|
| 52 |
+
|
| 53 |
+
} else {
|
| 54 |
+
$html .= ' <tr>
|
| 55 |
<td>Sooqr Conversion Suite</td>
|
| 56 |
<td><a href="https://my.sooqr.com/user/login" target="_blank">Login here</a></td>
|
| 57 |
</tr>';
|
app/code/community/Magmodules/Sooqr/Helper/Data.php
CHANGED
|
@@ -69,7 +69,14 @@ class Magmodules_Sooqr_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
| 69 |
$value = $this->getProductUrl($product, $config, $parent);
|
| 70 |
break;
|
| 71 |
case 'image_link':
|
| 72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
break;
|
| 74 |
case 'condition':
|
| 75 |
$value = $this->getProductCondition($product_data, $config);
|
|
@@ -167,23 +174,20 @@ class Magmodules_Sooqr_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
| 167 |
public function getProductUrl($product, $config, $parent)
|
| 168 |
{
|
| 169 |
if(!empty($parent)) {
|
| 170 |
-
if($parent->
|
| 171 |
-
$url = Mage::helper('core')->escapeHtml(trim($config['website_url'] . $parent->
|
| 172 |
-
} else {
|
| 173 |
-
$url = Mage::getModel('catalog/product')->setStoreId($config['store_id'])->load($parent->getId())->getProductUrl();
|
| 174 |
-
$url = preg_replace('/\?.*/', '', $url);
|
| 175 |
}
|
|
|
|
|
|
|
|
|
|
| 176 |
} else {
|
| 177 |
-
if($product->
|
| 178 |
-
$url = Mage::helper('core')->escapeHtml(trim($config['website_url'] . $product->
|
| 179 |
-
}
|
| 180 |
-
|
| 181 |
-
$url =
|
| 182 |
-
}
|
| 183 |
}
|
| 184 |
-
if(!empty($config['url_suffix'])) {
|
| 185 |
-
$url = $url . '?' . $config['url_suffix'];
|
| 186 |
-
}
|
| 187 |
if(!empty($parent) && !empty($config['conf_switch_urls'])) {
|
| 188 |
if($parent->getTypeId() == 'configurable') {
|
| 189 |
$productAttributeOptions = $parent->getTypeInstance(true)->getConfigurableAttributesAsArray($parent);
|
|
@@ -206,12 +210,14 @@ class Magmodules_Sooqr_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
| 206 |
$image_data = array();
|
| 207 |
if(!empty($config['image_resize']) && !empty($config['image_size'])) {
|
| 208 |
$image_file = $product->getData($config['image_source']);
|
| 209 |
-
$
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
|
|
|
|
|
|
| 215 |
} else {
|
| 216 |
$image = '';
|
| 217 |
if(!empty($config['media_attributes'])) {
|
|
@@ -612,15 +618,18 @@ class Magmodules_Sooqr_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
| 612 |
foreach ($options as $option) {
|
| 613 |
$selection = $option->getDefaultSelection();
|
| 614 |
if($selection === null) { continue; }
|
| 615 |
-
$
|
| 616 |
-
$
|
|
|
|
|
|
|
|
|
|
| 617 |
}
|
| 618 |
}
|
| 619 |
if($price < 0.01) {
|
| 620 |
$price = Mage::helper('tax')->getPrice($product, $product->getFinalPrice(), true);
|
| 621 |
}
|
| 622 |
return $price;
|
| 623 |
-
}
|
| 624 |
|
| 625 |
public function getPriceGrouped($product, $pricemodel = '')
|
| 626 |
{
|
|
@@ -640,6 +649,43 @@ class Magmodules_Sooqr_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
| 640 |
}
|
| 641 |
}
|
| 642 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 643 |
public function checkOldVersion($dir)
|
| 644 |
{
|
| 645 |
if($dir) {
|
| 69 |
$value = $this->getProductUrl($product, $config, $parent);
|
| 70 |
break;
|
| 71 |
case 'image_link':
|
| 72 |
+
if(!empty($parent)) {
|
| 73 |
+
$value = $this->getProductImage($product, $config);
|
| 74 |
+
if(empty($value)) {
|
| 75 |
+
$value = $this->getProductImage($parent, $config);
|
| 76 |
+
}
|
| 77 |
+
} else {
|
| 78 |
+
$value = $this->getProductImage($product_data, $config);
|
| 79 |
+
}
|
| 80 |
break;
|
| 81 |
case 'condition':
|
| 82 |
$value = $this->getProductCondition($product_data, $config);
|
| 174 |
public function getProductUrl($product, $config, $parent)
|
| 175 |
{
|
| 176 |
if(!empty($parent)) {
|
| 177 |
+
if($parent->getUrlKey()) {
|
| 178 |
+
$url = Mage::helper('core')->escapeHtml(trim($config['website_url'] . $parent->getUrlKey()));
|
|
|
|
|
|
|
|
|
|
| 179 |
}
|
| 180 |
+
if($product->getRequestPath()) {
|
| 181 |
+
$url = Mage::helper('core')->escapeHtml(trim($config['website_url'] . $parent->getRequestPath()));
|
| 182 |
+
}
|
| 183 |
} else {
|
| 184 |
+
if($product->getUrlKey()) {
|
| 185 |
+
$url = Mage::helper('core')->escapeHtml(trim($config['website_url'] . $product->getUrlKey()));
|
| 186 |
+
}
|
| 187 |
+
if($product->getRequestPath()) {
|
| 188 |
+
$url = Mage::helper('core')->escapeHtml(trim($config['website_url'] . $product->getRequestPath()));
|
| 189 |
+
}
|
| 190 |
}
|
|
|
|
|
|
|
|
|
|
| 191 |
if(!empty($parent) && !empty($config['conf_switch_urls'])) {
|
| 192 |
if($parent->getTypeId() == 'configurable') {
|
| 193 |
$productAttributeOptions = $parent->getTypeInstance(true)->getConfigurableAttributesAsArray($parent);
|
| 210 |
$image_data = array();
|
| 211 |
if(!empty($config['image_resize']) && !empty($config['image_size'])) {
|
| 212 |
$image_file = $product->getData($config['image_source']);
|
| 213 |
+
if($image_file != 'no_selection') {
|
| 214 |
+
$imageModel = Mage::getModel('catalog/product_image')->setSize($config['image_size'])->setDestinationSubdir($config['image_source'])->setBaseFile($image_file);
|
| 215 |
+
if(!$imageModel->isCached()) {
|
| 216 |
+
$imageModel->resize()->saveFile();
|
| 217 |
+
}
|
| 218 |
+
$productImage = $imageModel->getUrl();
|
| 219 |
+
return (string)$productImage;
|
| 220 |
+
}
|
| 221 |
} else {
|
| 222 |
$image = '';
|
| 223 |
if(!empty($config['media_attributes'])) {
|
| 618 |
foreach ($options as $option) {
|
| 619 |
$selection = $option->getDefaultSelection();
|
| 620 |
if($selection === null) { continue; }
|
| 621 |
+
$selection_product_id = $selection->getProductId();
|
| 622 |
+
$_resource = Mage::getSingleton('catalog/product')->getResource();
|
| 623 |
+
$final_price = $_resource->getAttributeRawValue($selection_product_id, 'final_price', $storeId);
|
| 624 |
+
$selection_qty = $_resource->getAttributeRawValue($selection_product_id, 'selection_qty', $storeId);
|
| 625 |
+
$price += ($final_price * $selection_qty);
|
| 626 |
}
|
| 627 |
}
|
| 628 |
if($price < 0.01) {
|
| 629 |
$price = Mage::helper('tax')->getPrice($product, $product->getFinalPrice(), true);
|
| 630 |
}
|
| 631 |
return $price;
|
| 632 |
+
}
|
| 633 |
|
| 634 |
public function getPriceGrouped($product, $pricemodel = '')
|
| 635 |
{
|
| 649 |
}
|
| 650 |
}
|
| 651 |
|
| 652 |
+
public function getTypePrices($config, $products)
|
| 653 |
+
{
|
| 654 |
+
$type_prices = array();
|
| 655 |
+
if(!empty($config['conf_enabled'])) {
|
| 656 |
+
foreach($products as $product) {
|
| 657 |
+
if($product->getTypeId() == 'configurable') {
|
| 658 |
+
$attributes = $product->getTypeInstance(true)->getConfigurableAttributes($product);
|
| 659 |
+
$att_prices = array();
|
| 660 |
+
$base_price = $product->getFinalPrice();
|
| 661 |
+
foreach ($attributes as $attribute){
|
| 662 |
+
$prices = $attribute->getPrices();
|
| 663 |
+
foreach ($prices as $price){
|
| 664 |
+
if ($price['is_percent']) {
|
| 665 |
+
$att_prices[$price['value_index']] = (float)$price['pricing_value'] * $base_price / 100;
|
| 666 |
+
} else {
|
| 667 |
+
$att_prices[$price['value_index']] = (float)$price['pricing_value'];
|
| 668 |
+
}
|
| 669 |
+
}
|
| 670 |
+
}
|
| 671 |
+
$simple = $product->getTypeInstance()->getUsedProducts();
|
| 672 |
+
$simple_prices = array();
|
| 673 |
+
foreach($simple as $sProduct) {
|
| 674 |
+
$total_price = $base_price;
|
| 675 |
+
foreach($attributes as $attribute) {
|
| 676 |
+
$value = $sProduct->getData($attribute->getProductAttribute()->getAttributeCode());
|
| 677 |
+
if(isset($att_prices[$value])) {
|
| 678 |
+
$total_price += $att_prices[$value];
|
| 679 |
+
}
|
| 680 |
+
}
|
| 681 |
+
$type_prices[$sProduct->getEntityId()] = number_format($total_price, 2, '.', '') . ' ' . $config['currency'];
|
| 682 |
+
}
|
| 683 |
+
}
|
| 684 |
+
}
|
| 685 |
+
}
|
| 686 |
+
return $type_prices;
|
| 687 |
+
}
|
| 688 |
+
|
| 689 |
public function checkOldVersion($dir)
|
| 690 |
{
|
| 691 |
if($dir) {
|
app/code/community/Magmodules/Sooqr/Model/Adminhtml/System/Config/Source/Image.php
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
|
| 4 |
+
* =============================================================
|
| 5 |
+
* NOTICE OF LICENSE [Single domain license]
|
| 6 |
+
* This source file is subject to the EULA that is
|
| 7 |
+
* available through the world-wide-web at:
|
| 8 |
+
* http://www.magmodules.eu/license-agreement/
|
| 9 |
+
* =============================================================
|
| 10 |
+
* @category Magmodules
|
| 11 |
+
* @package Magmodules_Sooqr
|
| 12 |
+
* @author Magmodules <info@magmodules.eu>
|
| 13 |
+
* @copyright Copyright (c) 2016 (http://www.magmodules.eu)
|
| 14 |
+
* @license http://www.magmodules.eu/license-agreement/
|
| 15 |
+
* =============================================================
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
class Magmodules_Sooqr_Model_Adminhtml_System_Config_Source_Image {
|
| 19 |
+
|
| 20 |
+
public function toOptionArray()
|
| 21 |
+
{
|
| 22 |
+
$position = array();
|
| 23 |
+
$position[] = array('value'=> '', 'label'=> Mage::helper('sooqr')->__('No'));
|
| 24 |
+
$position[] = array('value'=> 'incl', 'label'=> Mage::helper('sooqr')->__('Force including Tax'));
|
| 25 |
+
$position[] = array('value'=> 'excl', 'label'=> Mage::helper('sooqr')->__('Force excluding Tax'));
|
| 26 |
+
return $position;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
}
|
app/code/community/Magmodules/Sooqr/Model/Common.php
CHANGED
|
@@ -24,6 +24,7 @@ class Magmodules_Sooqr_Model_Common extends Mage_Core_Helper_Abstract {
|
|
| 24 |
$collection->setStore($store_id);
|
| 25 |
$collection->addStoreFilter($store_id);
|
| 26 |
$collection->addFinalPrice();
|
|
|
|
| 27 |
|
| 28 |
if(!empty($config['filter_enabled'])) {
|
| 29 |
$type = $config['filter_type'];
|
|
@@ -54,7 +55,7 @@ class Magmodules_Sooqr_Model_Common extends Mage_Core_Helper_Abstract {
|
|
| 54 |
|
| 55 |
// All attributes
|
| 56 |
$attributes = array();
|
| 57 |
-
|
| 58 |
$attributes[] = 'price';
|
| 59 |
$attributes[] = 'final_price';
|
| 60 |
$attributes[] = 'price_model';
|
| 24 |
$collection->setStore($store_id);
|
| 25 |
$collection->addStoreFilter($store_id);
|
| 26 |
$collection->addFinalPrice();
|
| 27 |
+
$collection->addUrlRewrite();
|
| 28 |
|
| 29 |
if(!empty($config['filter_enabled'])) {
|
| 30 |
$type = $config['filter_type'];
|
| 55 |
|
| 56 |
// All attributes
|
| 57 |
$attributes = array();
|
| 58 |
+
$attributes[] = 'url_key';
|
| 59 |
$attributes[] = 'price';
|
| 60 |
$attributes[] = 'final_price';
|
| 61 |
$attributes[] = 'price_model';
|
app/code/community/Magmodules/Sooqr/Model/Sooqr.php
CHANGED
|
@@ -22,12 +22,13 @@ class Magmodules_Sooqr_Model_Sooqr extends Magmodules_Sooqr_Model_Common {
|
|
| 22 |
$limit = $this->setMemoryLimit($store_id);
|
| 23 |
$config = $this->getFeedConfig($store_id);
|
| 24 |
$products = $this->getProducts($config, $config['limit']);
|
| 25 |
-
|
|
|
|
| 26 |
return $this->saveFeed($feed, $config, 'sooqr', count($feed['products']));
|
| 27 |
}
|
| 28 |
}
|
| 29 |
|
| 30 |
-
public function getFeedData($products, $config, $time_start)
|
| 31 |
{
|
| 32 |
foreach($products as $product) {
|
| 33 |
$parent_id = Mage::helper('sooqr')->getParentData($product, $config);
|
|
@@ -37,7 +38,7 @@ class Magmodules_Sooqr_Model_Sooqr extends Magmodules_Sooqr_Model_Common {
|
|
| 37 |
foreach($product_data as $key => $value) {
|
| 38 |
if((!is_array($value)) && (!empty($value) || is_numeric($value))) { $product_row[$key] = $value; }
|
| 39 |
}
|
| 40 |
-
if($extra_data = $this->getExtraDataFields($product_data, $config, $product)) {
|
| 41 |
$product_row = array_merge($product_row, $extra_data);
|
| 42 |
}
|
| 43 |
$feed['products'][] = $product_row;
|
|
@@ -133,13 +134,11 @@ class Magmodules_Sooqr_Model_Sooqr extends Magmodules_Sooqr_Model_Common {
|
|
| 133 |
$attributes['visibility'] = array('label' => 'visibility', 'source' => 'visibility');
|
| 134 |
$attributes['status'] = array('label' => 'status', 'source' => 'status');
|
| 135 |
$attributes['categories'] = array('label' => 'categories', 'source' => '', 'parent' => 1);
|
| 136 |
-
|
| 137 |
if($extra_fields = @unserialize(Mage::getStoreConfig('sooqr_connect/products/extra', $storeId))) {
|
| 138 |
foreach($extra_fields as $extra_field) {
|
| 139 |
$attributes[$extra_field['attribute']] = array('label' => $extra_field['attribute'], 'source' => $extra_field['attribute'], 'action' => 'striptags');
|
| 140 |
}
|
| 141 |
}
|
| 142 |
-
|
| 143 |
if($type == 'flatcheck') {
|
| 144 |
if($filters = @unserialize(Mage::getStoreConfig('sooqr_connect/products/advanced', $storeId))) {
|
| 145 |
foreach($filters as $filter) {
|
|
@@ -147,7 +146,6 @@ class Magmodules_Sooqr_Model_Sooqr extends Magmodules_Sooqr_Model_Common {
|
|
| 147 |
}
|
| 148 |
}
|
| 149 |
}
|
| 150 |
-
|
| 151 |
return Mage::helper('sooqr')->addAttributeData($attributes, $config);
|
| 152 |
}
|
| 153 |
|
|
@@ -201,28 +199,40 @@ class Magmodules_Sooqr_Model_Sooqr extends Magmodules_Sooqr_Model_Common {
|
|
| 201 |
}
|
| 202 |
}
|
| 203 |
|
| 204 |
-
protected function getPrices($data, $currency, $config)
|
| 205 |
{
|
| 206 |
$prices = array();
|
| 207 |
$prices['currency'] = $currency;
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 211 |
if(isset($data['sales_price'])) {
|
| 212 |
$prices['normal_price'] = $data['regular_price'];
|
| 213 |
$prices['price'] = $data['sales_price'];
|
| 214 |
} else {
|
| 215 |
$prices['price'] = $data['price'];
|
| 216 |
-
}
|
| 217 |
-
}
|
| 218 |
-
|
| 219 |
-
$prices['normal_price_' . strtolower($key)] = round(($data['regular_price'] * $value), 2);
|
| 220 |
-
$prices['price_' . strtolower($key)] = round(($data['sales_price'] * $value), 2);
|
| 221 |
-
} else {
|
| 222 |
-
$prices['price_' . strtolower($key)] = round(($data['price'] * $value), 2);
|
| 223 |
-
}
|
| 224 |
-
}
|
| 225 |
-
}
|
| 226 |
return $prices;
|
| 227 |
}
|
| 228 |
|
|
@@ -259,13 +269,13 @@ class Magmodules_Sooqr_Model_Sooqr extends Magmodules_Sooqr_Model_Common {
|
|
| 259 |
return $category_array;
|
| 260 |
}
|
| 261 |
|
| 262 |
-
protected function getExtraDataFields($product_data, $config, $product)
|
| 263 |
{
|
| 264 |
$_extra = array();
|
| 265 |
if($_category_data = $this->getCategoryData($product_data, $config)) {
|
| 266 |
$_extra = array_merge($_extra, $_category_data);
|
| 267 |
}
|
| 268 |
-
if($_prices = $this->getPrices($product_data['price'], $config['currency'], $config)) {
|
| 269 |
$_extra = array_merge($_extra, $_prices);
|
| 270 |
}
|
| 271 |
if($_assoc_id = $this->getAssocId($product_data)) {
|
| 22 |
$limit = $this->setMemoryLimit($store_id);
|
| 23 |
$config = $this->getFeedConfig($store_id);
|
| 24 |
$products = $this->getProducts($config, $config['limit']);
|
| 25 |
+
$prices = Mage::helper('sooqr')->getTypePrices($config, $products);
|
| 26 |
+
if($feed = $this->getFeedData($products, $config, $time_start, $prices)) {
|
| 27 |
return $this->saveFeed($feed, $config, 'sooqr', count($feed['products']));
|
| 28 |
}
|
| 29 |
}
|
| 30 |
|
| 31 |
+
public function getFeedData($products, $config, $time_start, $prices)
|
| 32 |
{
|
| 33 |
foreach($products as $product) {
|
| 34 |
$parent_id = Mage::helper('sooqr')->getParentData($product, $config);
|
| 38 |
foreach($product_data as $key => $value) {
|
| 39 |
if((!is_array($value)) && (!empty($value) || is_numeric($value))) { $product_row[$key] = $value; }
|
| 40 |
}
|
| 41 |
+
if($extra_data = $this->getExtraDataFields($product_data, $config, $product, $prices)) {
|
| 42 |
$product_row = array_merge($product_row, $extra_data);
|
| 43 |
}
|
| 44 |
$feed['products'][] = $product_row;
|
| 134 |
$attributes['visibility'] = array('label' => 'visibility', 'source' => 'visibility');
|
| 135 |
$attributes['status'] = array('label' => 'status', 'source' => 'status');
|
| 136 |
$attributes['categories'] = array('label' => 'categories', 'source' => '', 'parent' => 1);
|
|
|
|
| 137 |
if($extra_fields = @unserialize(Mage::getStoreConfig('sooqr_connect/products/extra', $storeId))) {
|
| 138 |
foreach($extra_fields as $extra_field) {
|
| 139 |
$attributes[$extra_field['attribute']] = array('label' => $extra_field['attribute'], 'source' => $extra_field['attribute'], 'action' => 'striptags');
|
| 140 |
}
|
| 141 |
}
|
|
|
|
| 142 |
if($type == 'flatcheck') {
|
| 143 |
if($filters = @unserialize(Mage::getStoreConfig('sooqr_connect/products/advanced', $storeId))) {
|
| 144 |
foreach($filters as $filter) {
|
| 146 |
}
|
| 147 |
}
|
| 148 |
}
|
|
|
|
| 149 |
return Mage::helper('sooqr')->addAttributeData($attributes, $config);
|
| 150 |
}
|
| 151 |
|
| 199 |
}
|
| 200 |
}
|
| 201 |
|
| 202 |
+
protected function getPrices($data, $currency, $config, $conf_prices, $id)
|
| 203 |
{
|
| 204 |
$prices = array();
|
| 205 |
$prices['currency'] = $currency;
|
| 206 |
+
if(!empty($conf_prices[$id])) {
|
| 207 |
+
$prices['price'] = $conf_prices[$id];
|
| 208 |
+
} else {
|
| 209 |
+
if(!empty($config['currency_data'])) {
|
| 210 |
+
foreach($config['currency_data'] as $key => $value) {
|
| 211 |
+
if($currency == $key) {
|
| 212 |
+
if(isset($data['sales_price'])) {
|
| 213 |
+
$prices['normal_price'] = $data['regular_price'];
|
| 214 |
+
$prices['price'] = $data['sales_price'];
|
| 215 |
+
} else {
|
| 216 |
+
$prices['price'] = $data['price'];
|
| 217 |
+
}
|
| 218 |
+
} else {
|
| 219 |
+
if(isset($data['sales_price'])) {
|
| 220 |
+
$prices['normal_price_' . strtolower($key)] = round(($data['regular_price'] * $value), 2);
|
| 221 |
+
$prices['price_' . strtolower($key)] = round(($data['sales_price'] * $value), 2);
|
| 222 |
+
} else {
|
| 223 |
+
$prices['price_' . strtolower($key)] = round(($data['price'] * $value), 2);
|
| 224 |
+
}
|
| 225 |
+
}
|
| 226 |
+
}
|
| 227 |
+
} else {
|
| 228 |
if(isset($data['sales_price'])) {
|
| 229 |
$prices['normal_price'] = $data['regular_price'];
|
| 230 |
$prices['price'] = $data['sales_price'];
|
| 231 |
} else {
|
| 232 |
$prices['price'] = $data['price'];
|
| 233 |
+
}
|
| 234 |
+
}
|
| 235 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 236 |
return $prices;
|
| 237 |
}
|
| 238 |
|
| 269 |
return $category_array;
|
| 270 |
}
|
| 271 |
|
| 272 |
+
protected function getExtraDataFields($product_data, $config, $product, $prices)
|
| 273 |
{
|
| 274 |
$_extra = array();
|
| 275 |
if($_category_data = $this->getCategoryData($product_data, $config)) {
|
| 276 |
$_extra = array_merge($_extra, $_category_data);
|
| 277 |
}
|
| 278 |
+
if($_prices = $this->getPrices($product_data['price'], $config['currency'], $config, $prices, $product->getEntityId())) {
|
| 279 |
$_extra = array_merge($_extra, $_prices);
|
| 280 |
}
|
| 281 |
if($_assoc_id = $this->getAssocId($product_data)) {
|
app/code/community/Magmodules/Sooqr/controllers/Adminhtml/SooqrController.php
CHANGED
|
@@ -82,7 +82,7 @@ class Magmodules_Sooqr_Adminhtml_SooqrController extends Mage_Adminhtml_Controll
|
|
| 82 |
|
| 83 |
protected function _isAllowed()
|
| 84 |
{
|
| 85 |
-
return Mage::getSingleton('admin/session')->isAllowed('admin/sooqr_connect
|
| 86 |
}
|
| 87 |
|
| 88 |
}
|
| 82 |
|
| 83 |
protected function _isAllowed()
|
| 84 |
{
|
| 85 |
+
return Mage::getSingleton('admin/session')->isAllowed('admin/system/config/sooqr_connect');
|
| 86 |
}
|
| 87 |
|
| 88 |
}
|
app/code/community/Magmodules/Sooqr/etc/adminhtml.xml
CHANGED
|
@@ -31,18 +31,7 @@
|
|
| 31 |
</children>
|
| 32 |
</config>
|
| 33 |
</children>
|
| 34 |
-
</system>
|
| 35 |
-
<sooqr module="sooqr">
|
| 36 |
-
<title>Sooqr</title>
|
| 37 |
-
<sort_order>200</sort_order>
|
| 38 |
-
<children>
|
| 39 |
-
<sooqr module="sooqr">
|
| 40 |
-
<title>Sooqr Manual Feed Generation</title>
|
| 41 |
-
<sort_order>100</sort_order>
|
| 42 |
-
<action>adminhtml/sooqr/</action>
|
| 43 |
-
</sooqr>
|
| 44 |
-
</children>
|
| 45 |
-
</sooqr>
|
| 46 |
</children>
|
| 47 |
</admin>
|
| 48 |
</resources>
|
| 31 |
</children>
|
| 32 |
</config>
|
| 33 |
</children>
|
| 34 |
+
</system>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
</children>
|
| 36 |
</admin>
|
| 37 |
</resources>
|
app/code/community/Magmodules/Sooqr/etc/config.xml
CHANGED
|
@@ -19,7 +19,7 @@
|
|
| 19 |
<config>
|
| 20 |
<modules>
|
| 21 |
<Magmodules_Sooqr>
|
| 22 |
-
<version>1.1.
|
| 23 |
</Magmodules_Sooqr>
|
| 24 |
</modules>
|
| 25 |
<global>
|
| 19 |
<config>
|
| 20 |
<modules>
|
| 21 |
<Magmodules_Sooqr>
|
| 22 |
+
<version>1.1.4</version>
|
| 23 |
</Magmodules_Sooqr>
|
| 24 |
</modules>
|
| 25 |
<global>
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Magmodules_Sooqr</name>
|
| 4 |
-
<version>1.1.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://www.magmodules.eu/license-agreement/">Single Server License</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -9,10 +9,10 @@
|
|
| 9 |
<summary>Magmodules_Sooqr</summary>
|
| 10 |
<description>Magmodules_Sooqr</description>
|
| 11 |
<notes>Magmodules_Sooqr</notes>
|
| 12 |
-
<authors><author><name>Magmodules</name><user>
|
| 13 |
-
<date>2016-
|
| 14 |
-
<time>
|
| 15 |
-
<contents><target name="magecommunity"><dir name="Magmodules"><dir name="Sooqr"><dir name="Block"><dir name="Adminhtml"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Extra.php" hash="e583284820c631015ed78c131bf3cfa8"/><file name="Filter.php" hash="e21c1f53da21d4f3afbfe7691efce06e"/></dir><dir name="Renderer"><file name="Select.php" hash="69d71d66aaf7b842ef482affd484ec48"/></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Feeds.php" hash="29007ed679b14e737b5dd784fc0eb668"/><file name="Heading.php" hash="a89db4f294f9c9e6785745163b1aed5f"/><file name="Note.php" hash="f131e40d8a0f4ed2e444d9e692a91ed5"/><file name="Version.php" hash="5832a42f30122977420d722683211f66"/></dir></dir></dir></dir><dir name="Widget"><dir name="Info"><file name="Info.php" hash="
|
| 16 |
<compatible/>
|
| 17 |
-
<dependencies
|
| 18 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Magmodules_Sooqr</name>
|
| 4 |
+
<version>1.1.4</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://www.magmodules.eu/license-agreement/">Single Server License</license>
|
| 7 |
<channel>community</channel>
|
| 9 |
<summary>Magmodules_Sooqr</summary>
|
| 10 |
<description>Magmodules_Sooqr</description>
|
| 11 |
<notes>Magmodules_Sooqr</notes>
|
| 12 |
+
<authors><author><name>Magmodules</name><user>magmodules</user><email>info@magmodules.nl</email></author></authors>
|
| 13 |
+
<date>2016-06-14</date>
|
| 14 |
+
<time>17:57:24</time>
|
| 15 |
+
<contents><target name="magecommunity"><dir name="Magmodules"><dir name="Sooqr"><dir name="Block"><dir name="Adminhtml"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Extra.php" hash="e583284820c631015ed78c131bf3cfa8"/><file name="Filter.php" hash="e21c1f53da21d4f3afbfe7691efce06e"/></dir><dir name="Renderer"><file name="Select.php" hash="69d71d66aaf7b842ef482affd484ec48"/></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Feeds.php" hash="29007ed679b14e737b5dd784fc0eb668"/><file name="Heading.php" hash="a89db4f294f9c9e6785745163b1aed5f"/><file name="Note.php" hash="f131e40d8a0f4ed2e444d9e692a91ed5"/><file name="Version.php" hash="5832a42f30122977420d722683211f66"/></dir></dir></dir></dir><dir name="Widget"><dir name="Info"><file name="Info.php" hash="e8504af6f540c446f46603644cbe0e25"/></dir></dir></dir><file name="Search.php" hash="ac26f28b9b19908e75a6631a89000a21"/></dir><dir name="Helper"><file name="Data.php" hash="647b5e642566af455a3afcd312be1701"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Design"><file name="Extra.php" hash="3e262b80ccc673e415bf51bf172c72d4"/><file name="Filter.php" hash="e6fac56290f6d0d7be78553e75cb18a3"/></dir><dir name="Sooqr"><file name="Cron.php" hash="630c80fd165087f8a75a6c9fa3dad9b6"/></dir></dir><dir name="Source"><file name="Action.php" hash="ef9830d9c1a98c94991626c4cc4909c9"/><file name="Attribute.php" hash="6f3736cd2f7de23b9d74356d7c1c557f"/><file name="Cacheresize.php" hash="86a916189abef3a670e58f3a8298f894"/><file name="Category.php" hash="92b245d0758fbe075b79c397a96d8567"/><file name="Categorytype.php" hash="8bc5f054db86f543019a6762a6a98562"/><file name="Condition.php" hash="bd66be4fe74f549d5fa6c213bd9b64f6"/><file name="Conditions.php" hash="502fe20b60e397240b8d552fd5ea4d81"/><file name="Configurable.php" hash="34a165474618953e44fd1de305371907"/><file name="Frequency.php" hash="f03bd90b098412026b21884e72c89aaf"/><file name="Identifier.php" hash="cdf5bd32696cb92a6f3be396ce5b3a6d"/><file name="Image.php" hash="610936b70a0cf63a3497a912bf885e06"/><file name="Images.php" hash="08658a5e913e334959ec476a61e2891f"/><file name="Pricemodel.php" hash="dbbeabc2853a7caecab3fc42a557766b"/><file name="Productid.php" hash="e4b431e0183d91bdd4f186f001119e77"/><file name="Producttype.php" hash="88d0e8386f59d7c0ea62a19cbf800fa4"/><file name="Resize.php" hash="1a0824757d8c87f85225f063de3a025b"/><file name="Selectattribute.php" hash="bcae6eff0788821f7d3dbf7d224b59e4"/><file name="Status.php" hash="2f474fe7188e3b1cf1d1714ffebcd9e8"/><file name="Tax.php" hash="c6e19d702751bc0c616768fceaf53855"/><file name="Textattribute.php" hash="9645d5652679a972a280cf337ab8662b"/><file name="Varcharattribute.php" hash="37a9253e8ea806f3402052a0b0744707"/><file name="Version.php" hash="906736f8f04f03421ab56a0c042639aa"/><file name="Visibility.php" hash="67f20c3b4581144b11ca8696c885b97d"/><file name="Weight.php" hash="fbc88d0b6bd073d00dc6e4a05ce1b4df"/></dir></dir></dir></dir><file name="Common.php" hash="b93ebcb4666437da90a125b99f0c5c5c"/><file name="Observer.php" hash="3a996b43992803a0d03ffcdae644b40e"/><file name="Sooqr.php" hash="b4b4802b5f39e8640fec72ed0d0d16c6"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="SooqrController.php" hash="1d496d91a588da38337d1c1b0bdf2185"/></dir><file name="InstallationController.php" hash="a96e58cbab2c7b6a3a4c9b42de62a59f"/></dir><dir name="etc"><file name="adminhtml.xml" hash="cf4313a4daa72837c48e137b51b11eba"/><file name="config.xml" hash="e71ce7ee086a552b2daa9d74b87ad475"/><file name="system.xml" hash="54460f3418fd5924b4fd46b473a94843"/></dir></dir></dir></target><target name="magelocale"><dir><dir name="en_US"><file name="Magmodules_Sooqr.csv" hash="38992a5f4cf87eeee3d06ab38ead900b"/></dir><dir name="nl_NL"><file name="Magmodules_Sooqr.csv" hash="2fe3afa7c7597cf53c985aef2388ae24"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Magmodules_Sooqr.xml" hash="eeec89a005c4ccb1ed86bf90c446e3ef"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="magmodules"><dir name="sooqr"><file name="form.mini.phtml" hash="2776e200a99a369182599f6c9177e11b"/></dir></dir></dir><dir name="layout"><file name="magmodules_sooqr.xml" hash="ca15953b214016a800c5ef3aa8da4d19"/></dir></dir></dir></dir></target></contents>
|
| 16 |
<compatible/>
|
| 17 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
| 18 |
</package>
|
