Version Notes
This module allows you to sync your Magento Retail store to the Sniip marketplace, allowing shoppers to browse and shop on your store within a native app experience.
Download this release
Release Info
Developer | Cliff Viegas |
Extension | Sniip_Retailer_Connect |
Version | 1.0.9.8 |
Comparing to | |
See all releases |
Code changes from version 1.0.9.7 to 1.0.9.8
app/code/community/Sniip/Sniipsync/Model/Sniipgateway.php
CHANGED
@@ -8,12 +8,12 @@
|
|
8 |
class Sniip_Sniipsync_Model_Sniipgateway extends Mage_Payment_Model_Method_Abstract
|
9 |
{
|
10 |
|
11 |
-
protected $_code = 'sniipgateway';
|
12 |
-
|
13 |
-
|
14 |
-
protected $_canUseCheckout = false;
|
15 |
-
public function setCheckout (){
|
16 |
-
$this->_canUseCheckout = true;
|
17 |
-
}
|
18 |
|
19 |
}
|
8 |
class Sniip_Sniipsync_Model_Sniipgateway extends Mage_Payment_Model_Method_Abstract
|
9 |
{
|
10 |
|
11 |
+
// protected $_code = 'sniipgateway';
|
12 |
+
//// protected $_isInitializeNeeded = true;
|
13 |
+
//// protected $_canUseInternal = true;
|
14 |
+
// protected $_canUseCheckout = false;
|
15 |
+
// public function setCheckout (){
|
16 |
+
// $this->_canUseCheckout = true;
|
17 |
+
// }
|
18 |
|
19 |
}
|
app/code/community/Sniip/Sniipsync/Model/Sniipsync/Api.php
CHANGED
@@ -102,8 +102,8 @@ class Sniip_Sniipsync_Model_Sniipsync_Api extends Sniip_Sniipsync_Model_Api_Reso
|
|
102 |
$quote = $this->_createOrGetCartInfo($store,$quoteId);
|
103 |
$quoteId = $quote->getId();
|
104 |
if(!$quoteId){
|
105 |
-
$this->_insert_updateProductToCart($
|
106 |
-
$this->_setCustomerToCart($
|
107 |
}
|
108 |
$ratesResult = $this->_getShippingMethod($store,$quoteId);
|
109 |
$result = $this->_getCartInfo($ratesResult,$quoteId,$store);
|
@@ -121,32 +121,75 @@ class Sniip_Sniipsync_Model_Sniipsync_Api extends Sniip_Sniipsync_Model_Api_Reso
|
|
121 |
*/
|
122 |
private function _getShippingMethod($store,$quoteId){
|
123 |
$quote = $this->_getQuote($store,$quoteId);
|
124 |
-
|
125 |
$quoteShippingAddress = $quote->getShippingAddress();
|
126 |
if (is_null($quoteShippingAddress->getId())) {
|
127 |
$this->_fault("shipping_address_is_not_set");
|
128 |
}
|
|
|
129 |
try {
|
130 |
$quoteShippingAddress->collectShippingRates()->save();
|
131 |
$groupedRates = $quoteShippingAddress->getGroupedAllShippingRates();
|
132 |
-
$
|
|
|
133 |
foreach ($groupedRates as $carrierCode => $rates ) {
|
134 |
$carrierName = $carrierCode;
|
135 |
if (!is_null(Mage::getStoreConfig('carriers/'.$carrierCode.'/title'))) {
|
136 |
$carrierName = Mage::getStoreConfig('carriers/'.$carrierCode.'/title');
|
137 |
}
|
138 |
foreach ($rates as $rate) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
$rateItem = $this->_getAttributes($rate, "quote_shipping_rate");
|
140 |
$rateItem['carrierName'] = $carrierName;
|
141 |
$ratesResult[] = $rateItem;
|
142 |
unset($rateItem);
|
143 |
}
|
144 |
}
|
|
|
145 |
} catch (Mage_Core_Exception $e) {
|
146 |
$this->_fault('shipping_methods_list_could_not_be_retrived'. $e->getMessage());
|
147 |
}
|
148 |
return $ratesResult;
|
149 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
/**
|
151 |
* Create customer and Add address for customer with guess account
|
152 |
*
|
@@ -156,7 +199,8 @@ class Sniip_Sniipsync_Model_Sniipsync_Api extends Sniip_Sniipsync_Model_Api_Reso
|
|
156 |
* @param string|int $store
|
157 |
* @return bool
|
158 |
*/
|
159 |
-
private function _setCustomerToCart($
|
|
|
160 |
$customerData = $this->_prepareCustomerData($customerData);
|
161 |
if (!isset($customerData['mode'])) {
|
162 |
$this->_fault('customer_mode_is_unknown');
|
@@ -175,14 +219,13 @@ class Sniip_Sniipsync_Model_Sniipsync_Api extends Sniip_Sniipsync_Model_Api_Reso
|
|
175 |
|
176 |
if ($customer->getMode() == self::MODE_GUEST) {
|
177 |
$password = $customer->generatePassword();
|
178 |
-
|
179 |
$customer
|
180 |
->setPassword($password)
|
181 |
->setPasswordConfirmation($password);
|
182 |
}
|
183 |
$isCustomerValid = $customer->validate();
|
184 |
if ($isCustomerValid !== true && is_array($isCustomerValid)) {
|
185 |
-
$this->_fault('customer_data_invalid'
|
186 |
}
|
187 |
break;
|
188 |
}
|
@@ -200,7 +243,8 @@ class Sniip_Sniipsync_Model_Sniipsync_Api extends Sniip_Sniipsync_Model_Api_Reso
|
|
200 |
$this->_fault('customer_not_set', $e->getMessage());
|
201 |
}
|
202 |
//--------------------------------------set Address ----------------------------------------------------
|
203 |
-
$quote = $this->_getQuote($store);
|
|
|
204 |
$customerAddressData = $this->_prepareCustomerAddressData($customerAddressData);
|
205 |
if (is_null($customerAddressData)) {
|
206 |
$this->_fault('customer_address_data_empty');
|
@@ -228,7 +272,7 @@ class Sniip_Sniipsync_Model_Sniipsync_Api extends Sniip_Sniipsync_Model_Api_Reso
|
|
228 |
$address->setSaveInAddressBook(1);
|
229 |
switch($addressMode) {
|
230 |
case self::ADDRESS_BILLING:
|
231 |
-
|
232 |
if (!$quote->isVirtual()) {
|
233 |
|
234 |
$usingCase = isset($addressItem['use_for_shipping']) ? (int)$addressItem['use_for_shipping'] : 0;
|
@@ -243,7 +287,7 @@ class Sniip_Sniipsync_Model_Sniipsync_Api extends Sniip_Sniipsync_Model_Api_Reso
|
|
243 |
$shippingAddress = $quote->getShippingAddress();
|
244 |
$shippingMethod = $shippingAddress->getShippingMethod();
|
245 |
$shippingAddress->addData($billingAddress->getData())
|
246 |
-
|
247 |
->setShippingMethod($shippingMethod)
|
248 |
->setCollectShippingRates(true);
|
249 |
|
@@ -252,13 +296,10 @@ class Sniip_Sniipsync_Model_Sniipsync_Api extends Sniip_Sniipsync_Model_Api_Reso
|
|
252 |
}
|
253 |
$quote->setBillingAddress($address);
|
254 |
break;
|
255 |
-
|
256 |
case self::ADDRESS_SHIPPING:
|
257 |
$address->setCollectShippingRates(true)
|
258 |
->setSameAsBilling(0);
|
259 |
$quote->setShippingAddress($address);
|
260 |
-
|
261 |
-
// return $quoteId . json_encode($address->getData());
|
262 |
break;
|
263 |
}
|
264 |
|
@@ -297,15 +338,14 @@ class Sniip_Sniipsync_Model_Sniipsync_Api extends Sniip_Sniipsync_Model_Api_Reso
|
|
297 |
* @param string|int $store
|
298 |
* @return boolean
|
299 |
*/
|
300 |
-
private function _insert_updateProductToCart($
|
301 |
-
|
302 |
-
$store = $quote->getStoreId();
|
303 |
-
}
|
304 |
$productsData = $this->_prepareProductsData($productsData);
|
305 |
if (empty($productsData)) {
|
306 |
$this->_fault('invalid_product_data');
|
307 |
}
|
308 |
$quote->removeAllItems();
|
|
|
309 |
foreach ($productsData as $productItem) {
|
310 |
if (isset($productItem['product_id'])) {
|
311 |
$productByItem = $this->_getProductInfo($productItem['product_id'], $store, "id");
|
@@ -326,7 +366,7 @@ class Sniip_Sniipsync_Model_Sniipsync_Api extends Sniip_Sniipsync_Model_Api_Reso
|
|
326 |
}
|
327 |
}
|
328 |
if (!empty($errors)) {
|
329 |
-
$this->_fault("update_product_fault"
|
330 |
}
|
331 |
try {
|
332 |
$quote->collectTotals()->save();
|
@@ -464,13 +504,14 @@ class Sniip_Sniipsync_Model_Sniipsync_Api extends Sniip_Sniipsync_Model_Api_Reso
|
|
464 |
}
|
465 |
|
466 |
}
|
|
|
467 |
$productsEntity = new stdClass();
|
468 |
$productsEntity->product_id = $product->getId();
|
469 |
$productsEntity->product_name = $product->getName();
|
470 |
$productsEntity->sku = $product->getSku();
|
471 |
$productsEntity->short_description = base64_encode($product->getShortDescription());
|
472 |
$productsEntity->description = base64_encode($product->getDescription());
|
473 |
-
$productsEntity->type_id = $
|
474 |
$productsEntity->price = $product->getPrice();
|
475 |
$productsEntity->special_price = $product->getSpecialPrice();
|
476 |
$productsEntity->special_from_date = $product->getSpecialFromDate();
|
@@ -519,11 +560,9 @@ class Sniip_Sniipsync_Model_Sniipsync_Api extends Sniip_Sniipsync_Model_Api_Reso
|
|
519 |
$productsEntity->websites = $product->getWebsiteIds();
|
520 |
$productsEntity->attribute = $this->_getAttrGroup($product->getId());
|
521 |
|
522 |
-
if ($product->hasData('links_exist')) {
|
523 |
$linkSamplesArr = $this->getLinkData($product);
|
524 |
$productsEntity->linkSamples = $linkSamplesArr;
|
525 |
-
$samplesArr = $this->getSampleData($product);
|
526 |
-
$productsEntity->samples = $samplesArr;
|
527 |
}
|
528 |
$products[] = $productsEntity;
|
529 |
}
|
@@ -597,72 +636,72 @@ class Sniip_Sniipsync_Model_Sniipsync_Api extends Sniip_Sniipsync_Model_Api_Reso
|
|
597 |
{
|
598 |
return array();
|
599 |
}
|
600 |
-
|
601 |
$linkArr = array();
|
602 |
$links = $product->getTypeInstance(true)->getLinks($product);
|
603 |
-
$
|
604 |
foreach ($links as $item) {
|
|
|
|
|
|
|
605 |
$tmpLinkItem = array(
|
606 |
'link_id' => $item->getId(),
|
607 |
-
'
|
608 |
-
'
|
|
|
|
|
609 |
'number_of_downloads' => $item->getNumberOfDownloads(),
|
610 |
-
'
|
611 |
-
'
|
612 |
-
'
|
|
|
|
|
|
|
|
|
613 |
'sample_file' => $item->getSampleFile(),
|
|
|
614 |
'sample_url' => $item->getSampleUrl(),
|
615 |
'sample_type' => $item->getSampleType(),
|
616 |
'sort_order' => $item->getSortOrder(),
|
|
|
617 |
);
|
618 |
-
$file = Mage::helper('downloadable/file')->getFilePath(
|
619 |
-
Mage_Downloadable_Model_Link::getBasePath(), $item->getLinkFile()
|
620 |
-
);
|
621 |
-
|
622 |
-
if ($item->getLinkFile() && !is_file($file)) {
|
623 |
-
Mage::helper('core/file_storage_database')->saveFileToFilesystem($file);
|
624 |
-
}
|
625 |
-
|
626 |
-
if ($item->getLinkFile() && is_file($file)) {
|
627 |
-
// $name = '<a href="'
|
628 |
-
// . $this->getUrl('*/downloadable_product_edit/link', array(
|
629 |
-
// 'id' => $item->getId(),
|
630 |
-
// '_secure' => true
|
631 |
-
// )) . '">' . Mage::helper('downloadable/file')->getFileFromPathFile($item->getLinkFile()) . '</a>';
|
632 |
-
$tmpLinkItem['file_save'] = array(
|
633 |
-
array(
|
634 |
-
'linkSampleUrl' => $this->getLinkSamlpeUrl($item),
|
635 |
-
'file' => $item->getLinkFile(),
|
636 |
-
'name' => Mage::helper('downloadable/file')->getFileFromPathFile($item->getLinkFile()),
|
637 |
-
'size' => filesize($file),
|
638 |
-
'status' => 'old'
|
639 |
-
));
|
640 |
-
}
|
641 |
-
$sampleFile = Mage::helper('downloadable/file')->getFilePath(
|
642 |
-
Mage_Downloadable_Model_Link::getBaseSamplePath(), $item->getSampleFile()
|
643 |
-
);
|
644 |
-
if ($item->getSampleFile() && is_file($sampleFile)) {
|
645 |
-
$tmpLinkItem['sample_file_save'] = array(
|
646 |
-
array(
|
647 |
-
'linkSampleUrl' => $this->getLinkSamlpeUrl($item),
|
648 |
-
'file' => $item->getSampleFile(),
|
649 |
-
'name' => Mage::helper('downloadable/file')->getFileFromPathFile($item->getSampleFile()),
|
650 |
-
'size' => filesize($sampleFile),
|
651 |
-
'status' => 'old'
|
652 |
-
));
|
653 |
-
}
|
654 |
if ($item->getNumberOfDownloads() == '0') {
|
655 |
-
$tmpLinkItem['is_unlimited'] =
|
656 |
}
|
657 |
if ($product->getStoreId() && $item->getStoreTitle()) {
|
658 |
$tmpLinkItem['store_title'] = $item->getStoreTitle();
|
659 |
}
|
660 |
-
if ($product->getStoreId() && $
|
661 |
$tmpLinkItem['website_price'] = $item->getWebsitePrice();
|
662 |
}
|
663 |
$linkArr[] = $tmpLinkItem;
|
664 |
}
|
665 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
666 |
}
|
667 |
|
668 |
|
@@ -789,7 +828,7 @@ class Sniip_Sniipsync_Model_Sniipsync_Api extends Sniip_Sniipsync_Model_Api_Reso
|
|
789 |
*
|
790 |
*/
|
791 |
public function getListGatewayActive(){
|
792 |
-
Sniip_Sniipsync_Model_Sniipgateway::setCheckout();
|
793 |
$payments = Mage::getSingleton('payment/config')->getActiveMethods();
|
794 |
$payMethods = array();
|
795 |
foreach ($payments as $paymentCode=>$paymentModel)
|
102 |
$quote = $this->_createOrGetCartInfo($store,$quoteId);
|
103 |
$quoteId = $quote->getId();
|
104 |
if(!$quoteId){
|
105 |
+
$this->_insert_updateProductToCart($quoteId,$productsData,$store);
|
106 |
+
$this->_setCustomerToCart($quoteId,$customerData,$customerAddressData,$store);
|
107 |
}
|
108 |
$ratesResult = $this->_getShippingMethod($store,$quoteId);
|
109 |
$result = $this->_getCartInfo($ratesResult,$quoteId,$store);
|
121 |
*/
|
122 |
private function _getShippingMethod($store,$quoteId){
|
123 |
$quote = $this->_getQuote($store,$quoteId);
|
124 |
+
|
125 |
$quoteShippingAddress = $quote->getShippingAddress();
|
126 |
if (is_null($quoteShippingAddress->getId())) {
|
127 |
$this->_fault("shipping_address_is_not_set");
|
128 |
}
|
129 |
+
$ratesResult = array();
|
130 |
try {
|
131 |
$quoteShippingAddress->collectShippingRates()->save();
|
132 |
$groupedRates = $quoteShippingAddress->getGroupedAllShippingRates();
|
133 |
+
$_sole = $this->getSole($groupedRates);
|
134 |
+
$_options = $this->getOptions();
|
135 |
foreach ($groupedRates as $carrierCode => $rates ) {
|
136 |
$carrierName = $carrierCode;
|
137 |
if (!is_null(Mage::getStoreConfig('carriers/'.$carrierCode.'/title'))) {
|
138 |
$carrierName = Mage::getStoreConfig('carriers/'.$carrierCode.'/title');
|
139 |
}
|
140 |
foreach ($rates as $rate) {
|
141 |
+
// $_excl =$this->getShippingPrice((float)$rate->getPrice(), Mage::helper('tax')->displayShippingPriceIncludingTax());
|
142 |
+
// $_incl =$this->getShippingPrice((float)$rate->getPrice(),true);
|
143 |
+
// $price = $_excl . ($_excl !== $_incl ? '(Incl. Tax'.$_incl.')' :'' );
|
144 |
+
$shippingType= "";
|
145 |
+
if(!$_sole && $carrierCode == 'temando'){
|
146 |
+
foreach($_options as $_option_id => $_option){
|
147 |
+
if ($_option instanceof Temando_Temando_Model_Option_Boolean){
|
148 |
+
if ($_option->getForcedValue() !== Temando_Temando_Model_Option_Boolean::NO)
|
149 |
+
{
|
150 |
+
$shippingType .= '_'.$_option_id.'_'.Temando_Temando_Model_Option_Boolean::YES;
|
151 |
+
}else{
|
152 |
+
$shippingType .= '_'.$_option_id.'_'.$_option->getForcedValue();
|
153 |
+
}
|
154 |
+
}
|
155 |
+
}
|
156 |
+
if (strpos($rate->getCode(), $shippingType) === false)
|
157 |
+
continue;
|
158 |
+
}
|
159 |
+
|
160 |
$rateItem = $this->_getAttributes($rate, "quote_shipping_rate");
|
161 |
$rateItem['carrierName'] = $carrierName;
|
162 |
$ratesResult[] = $rateItem;
|
163 |
unset($rateItem);
|
164 |
}
|
165 |
}
|
166 |
+
$quote->collectTotals()->save();
|
167 |
} catch (Mage_Core_Exception $e) {
|
168 |
$this->_fault('shipping_methods_list_could_not_be_retrived'. $e->getMessage());
|
169 |
}
|
170 |
return $ratesResult;
|
171 |
}
|
172 |
+
protected function getOptions()
|
173 |
+
{
|
174 |
+
$options = Mage::registry('temando_current_options');
|
175 |
+
if(!$options) {
|
176 |
+
$options = array();
|
177 |
+
}
|
178 |
+
|
179 |
+
return $options;
|
180 |
+
}
|
181 |
+
protected function getSole($groups)
|
182 |
+
{
|
183 |
+
// by default the following will return false. remove the
|
184 |
+
// line below to actually check if it is the only method
|
185 |
+
// return false;
|
186 |
+
if(count($groups) == 1) {
|
187 |
+
$rates = array_pop($groups);
|
188 |
+
if(count($rates) == 1) return true;
|
189 |
+
}
|
190 |
+
return false;
|
191 |
+
}
|
192 |
+
|
193 |
/**
|
194 |
* Create customer and Add address for customer with guess account
|
195 |
*
|
199 |
* @param string|int $store
|
200 |
* @return bool
|
201 |
*/
|
202 |
+
private function _setCustomerToCart($quoteId,$customerData,$customerAddressData,$store){
|
203 |
+
$quote = $this->_getQuote($store,$quoteId);
|
204 |
$customerData = $this->_prepareCustomerData($customerData);
|
205 |
if (!isset($customerData['mode'])) {
|
206 |
$this->_fault('customer_mode_is_unknown');
|
219 |
|
220 |
if ($customer->getMode() == self::MODE_GUEST) {
|
221 |
$password = $customer->generatePassword();
|
|
|
222 |
$customer
|
223 |
->setPassword($password)
|
224 |
->setPasswordConfirmation($password);
|
225 |
}
|
226 |
$isCustomerValid = $customer->validate();
|
227 |
if ($isCustomerValid !== true && is_array($isCustomerValid)) {
|
228 |
+
$this->_fault('customer_data_invalid: '. json_encode($isCustomerValid) );
|
229 |
}
|
230 |
break;
|
231 |
}
|
243 |
$this->_fault('customer_not_set', $e->getMessage());
|
244 |
}
|
245 |
//--------------------------------------set Address ----------------------------------------------------
|
246 |
+
$quote = $this->_getQuote($store,$quoteId);
|
247 |
+
|
248 |
$customerAddressData = $this->_prepareCustomerAddressData($customerAddressData);
|
249 |
if (is_null($customerAddressData)) {
|
250 |
$this->_fault('customer_address_data_empty');
|
272 |
$address->setSaveInAddressBook(1);
|
273 |
switch($addressMode) {
|
274 |
case self::ADDRESS_BILLING:
|
275 |
+
$address->setEmail($quote->getCustomer()->getEmail());
|
276 |
if (!$quote->isVirtual()) {
|
277 |
|
278 |
$usingCase = isset($addressItem['use_for_shipping']) ? (int)$addressItem['use_for_shipping'] : 0;
|
287 |
$shippingAddress = $quote->getShippingAddress();
|
288 |
$shippingMethod = $shippingAddress->getShippingMethod();
|
289 |
$shippingAddress->addData($billingAddress->getData())
|
290 |
+
->setSameAsBilling(1)
|
291 |
->setShippingMethod($shippingMethod)
|
292 |
->setCollectShippingRates(true);
|
293 |
|
296 |
}
|
297 |
$quote->setBillingAddress($address);
|
298 |
break;
|
|
|
299 |
case self::ADDRESS_SHIPPING:
|
300 |
$address->setCollectShippingRates(true)
|
301 |
->setSameAsBilling(0);
|
302 |
$quote->setShippingAddress($address);
|
|
|
|
|
303 |
break;
|
304 |
}
|
305 |
|
338 |
* @param string|int $store
|
339 |
* @return boolean
|
340 |
*/
|
341 |
+
private function _insert_updateProductToCart($quoteId, $productsData, $store = null){
|
342 |
+
$quote = $this->_getQuote($store,$quoteId);
|
|
|
|
|
343 |
$productsData = $this->_prepareProductsData($productsData);
|
344 |
if (empty($productsData)) {
|
345 |
$this->_fault('invalid_product_data');
|
346 |
}
|
347 |
$quote->removeAllItems();
|
348 |
+
$errors = array();
|
349 |
foreach ($productsData as $productItem) {
|
350 |
if (isset($productItem['product_id'])) {
|
351 |
$productByItem = $this->_getProductInfo($productItem['product_id'], $store, "id");
|
366 |
}
|
367 |
}
|
368 |
if (!empty($errors)) {
|
369 |
+
$this->_fault("update_product_fault".implode(' ', $errors));
|
370 |
}
|
371 |
try {
|
372 |
$quote->collectTotals()->save();
|
504 |
}
|
505 |
|
506 |
}
|
507 |
+
$type_id = $product->getTypeId();
|
508 |
$productsEntity = new stdClass();
|
509 |
$productsEntity->product_id = $product->getId();
|
510 |
$productsEntity->product_name = $product->getName();
|
511 |
$productsEntity->sku = $product->getSku();
|
512 |
$productsEntity->short_description = base64_encode($product->getShortDescription());
|
513 |
$productsEntity->description = base64_encode($product->getDescription());
|
514 |
+
$productsEntity->type_id = $type_id;
|
515 |
$productsEntity->price = $product->getPrice();
|
516 |
$productsEntity->special_price = $product->getSpecialPrice();
|
517 |
$productsEntity->special_from_date = $product->getSpecialFromDate();
|
560 |
$productsEntity->websites = $product->getWebsiteIds();
|
561 |
$productsEntity->attribute = $this->_getAttrGroup($product->getId());
|
562 |
|
563 |
+
if (strtolower($type_id) === 'downloadable' && $product->hasData('links_exist')) {
|
564 |
$linkSamplesArr = $this->getLinkData($product);
|
565 |
$productsEntity->linkSamples = $linkSamplesArr;
|
|
|
|
|
566 |
}
|
567 |
$products[] = $productsEntity;
|
568 |
}
|
636 |
{
|
637 |
return array();
|
638 |
}
|
|
|
639 |
$linkArr = array();
|
640 |
$links = $product->getTypeInstance(true)->getLinks($product);
|
641 |
+
$downloadHelper = Mage::helper('downloadable');
|
642 |
foreach ($links as $item) {
|
643 |
+
$file = Mage::helper('downloadable/file')->getFilePath(
|
644 |
+
Mage_Downloadable_Model_Link::getBasePath(), $item->getLinkFile()
|
645 |
+
);
|
646 |
$tmpLinkItem = array(
|
647 |
'link_id' => $item->getId(),
|
648 |
+
'product_id' => $item->getProductId(),
|
649 |
+
'title' => $item->getTitle(),
|
650 |
+
'store_title' => $item->getStoreTitle(),
|
651 |
+
'price' => $item->getPrice(),
|
652 |
'number_of_downloads' => $item->getNumberOfDownloads(),
|
653 |
+
'shareable' => $item->getIsShareable(),
|
654 |
+
'is_shareable' => Mage::helper('downloadable')->getIsShareable($item),
|
655 |
+
// 'link_file' => $item->getLinkFile(),
|
656 |
+
// 'link_name' => Mage::helper('downloadable/file')->getFileFromPathFile($item->getLinkFile()),
|
657 |
+
// 'link_url' => $item->getLinkUrl(),
|
658 |
+
// 'link_type' => $item->getLinkType(),
|
659 |
+
'linkSampleUrl' => $this->getLinkSamlpeUrl($item),
|
660 |
'sample_file' => $item->getSampleFile(),
|
661 |
+
'sample_name' => Mage::helper('downloadable/file')->getFileFromPathFile($item->getSampleFile()),
|
662 |
'sample_url' => $item->getSampleUrl(),
|
663 |
'sample_type' => $item->getSampleType(),
|
664 |
'sort_order' => $item->getSortOrder(),
|
665 |
+
'size' => filesize($file)
|
666 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
667 |
if ($item->getNumberOfDownloads() == '0') {
|
668 |
+
$tmpLinkItem['is_unlimited'] = 1;
|
669 |
}
|
670 |
if ($product->getStoreId() && $item->getStoreTitle()) {
|
671 |
$tmpLinkItem['store_title'] = $item->getStoreTitle();
|
672 |
}
|
673 |
+
if ($product->getStoreId() && $downloadHelper->getIsPriceWebsiteScope()) {
|
674 |
$tmpLinkItem['website_price'] = $item->getWebsitePrice();
|
675 |
}
|
676 |
$linkArr[] = $tmpLinkItem;
|
677 |
}
|
678 |
+
unset($item);
|
679 |
+
unset($tmpLinkItem);
|
680 |
+
unset($links);
|
681 |
+
|
682 |
+
$samples = $product->getTypeInstance(true)->getSamples($product);
|
683 |
+
$samplesArr = array();
|
684 |
+
foreach ($samples as $item) {
|
685 |
+
$file = Mage::helper('downloadable/file')->getFilePath(
|
686 |
+
Mage_Downloadable_Model_Sample::getBasePath(), $item->getSampleFile()
|
687 |
+
);
|
688 |
+
$sampleName = Mage::helper('downloadable/file')->getFileFromPathFile($item->getSampleFile());
|
689 |
+
$tmpSampleItem = array(
|
690 |
+
'sample_id' => $item->getId(),
|
691 |
+
'product_id' => $item->getProductId(),
|
692 |
+
'title' => Mage::helper('core')->escapeHtml($item->getTitle(), null),
|
693 |
+
'store_title' => $item->getStoreTitle(),
|
694 |
+
'linkSampleUrl' => $this->getSampleUrl($item),
|
695 |
+
'sample_name' => (!empty($sampleName))? $sampleName: '',
|
696 |
+
'sample_url' => $item->getSampleUrl(),
|
697 |
+
'sample_file' => $item->getSampleFile(),
|
698 |
+
'sample_type' => $item->getSampleType(),
|
699 |
+
'sort_order' => $item->getSortOrder(),
|
700 |
+
'size' => filesize($file)
|
701 |
+
);
|
702 |
+
$samplesArr[] = $tmpSampleItem;
|
703 |
+
}
|
704 |
+
return array('links' => $linkArr, 'samples' => $samplesArr);
|
705 |
}
|
706 |
|
707 |
|
828 |
*
|
829 |
*/
|
830 |
public function getListGatewayActive(){
|
831 |
+
// Sniip_Sniipsync_Model_Sniipgateway::setCheckout();
|
832 |
$payments = Mage::getSingleton('payment/config')->getActiveMethods();
|
833 |
$payMethods = array();
|
834 |
foreach ($payments as $paymentCode=>$paymentModel)
|
app/code/community/Sniip/Sniipsync/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Sniip_Sniipsync>
|
5 |
-
<version>1.0.9.
|
6 |
</Sniip_Sniipsync>
|
7 |
</modules>
|
8 |
<frontend>
|
@@ -11,14 +11,12 @@
|
|
11 |
<use>standard</use>
|
12 |
<args>
|
13 |
<module>Sniip_Sniipsync</module>
|
14 |
-
<frontName>sniipgateway</frontName>
|
15 |
</args>
|
16 |
</sniipsync>
|
17 |
</routers>
|
18 |
<layout>
|
19 |
<updates>
|
20 |
<sniipsync>
|
21 |
-
<file>sniipgateway.xml</file>
|
22 |
</sniipsync>
|
23 |
</updates>
|
24 |
</layout>
|
@@ -29,7 +27,6 @@
|
|
29 |
<use>admin</use>
|
30 |
<args>
|
31 |
<module>Sniip_Sniipsync</module>
|
32 |
-
<frontName>sniipgateway</frontName>
|
33 |
</args>
|
34 |
</sniipsync>
|
35 |
</routers>
|
@@ -54,7 +51,6 @@
|
|
54 |
<layout>
|
55 |
<updates>
|
56 |
<sniipsync>
|
57 |
-
<file>sniipgateway.xml</file>
|
58 |
</sniipsync>
|
59 |
</updates>
|
60 |
</layout>
|
@@ -63,14 +59,10 @@
|
|
63 |
<models>
|
64 |
<sniipsync>
|
65 |
<class>Sniip_Sniipsync_Model</class>
|
66 |
-
<resourceModel>sniipgateway_mysql4</resourceModel>
|
67 |
</sniipsync>
|
68 |
<sniipsync_mysql4>
|
69 |
<class>Sniip_Sniipsync_Model_Mysql4</class>
|
70 |
<entities>
|
71 |
-
<sniipsync>
|
72 |
-
<table>sniipgateway</table>
|
73 |
-
</sniipsync>
|
74 |
</entities>
|
75 |
</sniipsync_mysql4>
|
76 |
</models>
|
@@ -107,14 +99,6 @@
|
|
107 |
</global>
|
108 |
|
109 |
<default>
|
110 |
-
<payment>
|
111 |
-
<sniipgateway>
|
112 |
-
<active>1</active>
|
113 |
-
<model>sniipsync/sniipgateway</model>
|
114 |
-
<order_status>processing</order_status>
|
115 |
-
<title>Sniip Gateway</title>
|
116 |
-
</sniipgateway>
|
117 |
-
</payment>
|
118 |
</default>
|
119 |
|
120 |
</config>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Sniip_Sniipsync>
|
5 |
+
<version>1.0.9.8</version>
|
6 |
</Sniip_Sniipsync>
|
7 |
</modules>
|
8 |
<frontend>
|
11 |
<use>standard</use>
|
12 |
<args>
|
13 |
<module>Sniip_Sniipsync</module>
|
|
|
14 |
</args>
|
15 |
</sniipsync>
|
16 |
</routers>
|
17 |
<layout>
|
18 |
<updates>
|
19 |
<sniipsync>
|
|
|
20 |
</sniipsync>
|
21 |
</updates>
|
22 |
</layout>
|
27 |
<use>admin</use>
|
28 |
<args>
|
29 |
<module>Sniip_Sniipsync</module>
|
|
|
30 |
</args>
|
31 |
</sniipsync>
|
32 |
</routers>
|
51 |
<layout>
|
52 |
<updates>
|
53 |
<sniipsync>
|
|
|
54 |
</sniipsync>
|
55 |
</updates>
|
56 |
</layout>
|
59 |
<models>
|
60 |
<sniipsync>
|
61 |
<class>Sniip_Sniipsync_Model</class>
|
|
|
62 |
</sniipsync>
|
63 |
<sniipsync_mysql4>
|
64 |
<class>Sniip_Sniipsync_Model_Mysql4</class>
|
65 |
<entities>
|
|
|
|
|
|
|
66 |
</entities>
|
67 |
</sniipsync_mysql4>
|
68 |
</models>
|
99 |
</global>
|
100 |
|
101 |
<default>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
</default>
|
103 |
|
104 |
</config>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Sniip_Retailer_Connect</name>
|
4 |
-
<version>1.0.9.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Source Licence (OSL)</license>
|
7 |
<channel>community</channel>
|
@@ -10,9 +10,9 @@
|
|
10 |
<description>Sniip brings together a variety of retail shopping brands and service providers under one easy to use app. You can shop across the entire Sniip community of retailers, pay your bills and even pay your parking, on your mobile, 24/7.</description>
|
11 |
<notes>This module allows you to sync your Magento Retail store to the Sniip marketplace, allowing shoppers to browse and shop on your store within a native app experience.</notes>
|
12 |
<authors><author><name>Cliff Viegas</name><user>CLIFF</user><email>cliff.viegas@sniip.com</email></author></authors>
|
13 |
-
<date>2015-
|
14 |
-
<time>
|
15 |
-
<contents><target name="mageetc"><dir name="modules"><file name="Sniip_Sniipsync.xml" hash="d38cd3dae11b1bd18271a73174300e7c"/></dir></target><target name="magecommunity"><dir name="Sniip"><dir name="Sniipsync"><dir name="Helper"><file name="Data.php" hash="0192bd72a9dc1e1b5f65669271c5b472"/></dir><dir name="Model"><dir name="Api"><file name="Resource.php" hash="e97f33392c0b248741b22801e08e53cd"/></dir><file name="Sniipgateway.php" hash="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Sniip_Retailer_Connect</name>
|
4 |
+
<version>1.0.9.8</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Source Licence (OSL)</license>
|
7 |
<channel>community</channel>
|
10 |
<description>Sniip brings together a variety of retail shopping brands and service providers under one easy to use app. You can shop across the entire Sniip community of retailers, pay your bills and even pay your parking, on your mobile, 24/7.</description>
|
11 |
<notes>This module allows you to sync your Magento Retail store to the Sniip marketplace, allowing shoppers to browse and shop on your store within a native app experience.</notes>
|
12 |
<authors><author><name>Cliff Viegas</name><user>CLIFF</user><email>cliff.viegas@sniip.com</email></author></authors>
|
13 |
+
<date>2015-10-14</date>
|
14 |
+
<time>05:13:17</time>
|
15 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Sniip_Sniipsync.xml" hash="d38cd3dae11b1bd18271a73174300e7c"/></dir></target><target name="magecommunity"><dir name="Sniip"><dir name="Sniipsync"><dir name="Helper"><file name="Data.php" hash="0192bd72a9dc1e1b5f65669271c5b472"/></dir><dir name="Model"><dir name="Api"><file name="Resource.php" hash="e97f33392c0b248741b22801e08e53cd"/></dir><file name="Sniipgateway.php" hash="808dc1c7c56b56d7e315a66af6a59216"/><dir name="Sniipsync"><dir name="Api"><file name="V2.php" hash="4fb5c03ef6bca75467a38c270387070b"/></dir><file name="Api.php" hash="8ae85db9fc329d50fcf0115930b20172"/></dir></dir><dir name="etc"><file name="api.xml" hash="765f6e98de535b8cc10d5590f9e95343"/><file name="config.xml" hash="4d75aab22ed0be875b528e366c5f3fa1"/><file name="system.xml" hash="d92d8ac8d8340df5cdc5dd099329c234"/><file name="wsdl.xml" hash="f3237d52103615aa4c1e5ebee71c9fc3"/><file name="wsi.xml" hash="2a5be8042a92c7acfead8ec18b8045f0"/></dir><dir name="sql"><dir name="sniipsync_setup"><file name="install-1.0.0.php" hash="564104566af5cb8cf1d0914accdfc7cc"/></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>
|