Ometria_Magento_Extension - Version 1.1.0

Version Notes

Additional APIS for coupon code generation and stock levels.

Some small fixes around identification and abandoned baskets.

Download this release

Release Info

Developer Alastair James
Extension Ometria_Magento_Extension
Version 1.1.0
Comparing to
See all releases


Code changes from version 1.0.0 to 1.1.0

app/code/community/Ometria/AbandonedCarts/controllers/CartlinkController.php CHANGED
@@ -31,7 +31,7 @@ class Ometria_AbandonedCarts_CartlinkController extends Mage_Checkout_CartContro
31
  }
32
 
33
  if ($helper->shouldCheckDeeplinkgToken()){
34
- $computed_token = md5($quote->created_at.$quote->remote_ip);
35
 
36
  if ($token!=$computed_token) {
37
  $session->addNotice($message_incorrect_link);
@@ -45,8 +45,6 @@ class Ometria_AbandonedCarts_CartlinkController extends Mage_Checkout_CartContro
45
 
46
  $this->_getSession()->setQuoteId($quote->getId());
47
 
48
- // @todo set cookie channel for new basket
49
-
50
  $cart_path = $helper->getCartUrl();
51
  if (substr($cart_path,0,7)=='http://' || substr($cart_path,0,8)=='https://'){
52
  $this->_redirectUrl($cart_path);
31
  }
32
 
33
  if ($helper->shouldCheckDeeplinkgToken()){
34
+ $computed_token = substr(md5($quote->created_at.$quote->getId()), 0, 12);
35
 
36
  if ($token!=$computed_token) {
37
  $session->addNotice($message_incorrect_link);
45
 
46
  $this->_getSession()->setQuoteId($quote->getId());
47
 
 
 
48
  $cart_path = $helper->getCartUrl();
49
  if (substr($cart_path,0,7)=='http://' || substr($cart_path,0,8)=='https://'){
50
  $this->_redirectUrl($cart_path);
app/code/community/Ometria/AbandonedCarts/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Ometria_AbandonedCarts>
5
- <version>1.0.0</version>
6
  </Ometria_AbandonedCarts>
7
  </modules>
8
 
2
  <config>
3
  <modules>
4
  <Ometria_AbandonedCarts>
5
+ <version>1.1.0</version>
6
  </Ometria_AbandonedCarts>
7
  </modules>
8
 
app/code/community/Ometria/Api/Model/Api.php CHANGED
@@ -5,7 +5,8 @@ class Ometria_Api_Model_Api extends Mage_Api_Model_Resource_Abstract {
5
  * Return current Ometria API version
6
  */
7
  public function version(){
8
- return "3.0";
 
9
  }
10
 
11
  public function get_stock_levels($ids){
@@ -198,10 +199,14 @@ class Ometria_Api_Model_Api extends Mage_Api_Model_Resource_Abstract {
198
  $product = Mage::getModel('catalog/product');
199
  $productMediaConfig = Mage::getModel('catalog/product_media_config');
200
 
 
 
201
 
202
- $m = new Mage_Catalog_Model_Product_Api();
 
 
203
 
204
- $rewrites = $this->_load_product_rewrites($ids);
205
 
206
  $ret = array();
207
  foreach($ids as $id){
@@ -216,12 +221,13 @@ class Ometria_Api_Model_Api extends Mage_Api_Model_Resource_Abstract {
216
 
217
  // Additional code to return parent information if available
218
  if ($info['type'] == "simple"){
219
- if($parentIds = $configurable_product_model->getParentIdsByChild($info['product_id'])) {
220
- $info['parent_product_ids'] = $parentIds;
221
  }
222
  }
223
 
224
  // Get Image URL
 
225
  $product->load($id);
226
  if ($product && $product->getId()==$info['product_id']){
227
  $imageUrl = $productMediaConfig->getMediaUrl($product->getSmallImage());
@@ -232,19 +238,13 @@ class Ometria_Api_Model_Api extends Mage_Api_Model_Resource_Abstract {
232
  $info['image_thumb_url'] = $imageUrl;
233
  }
234
 
235
- // URLs
236
- $info['urls'] = isset($rewrites[$id]) ? array_values($rewrites[$id]) : array();
237
-
238
- // Stock
239
- try{
240
- $stock_item = Mage::getModel('cataloginventory/stock_item')->loadByProduct($id);
241
- $stock = array();
242
- $stock['qty'] = $stock_item->getQty();
243
- $stock['is_in_stock'] = $stock_item->getIsInStock();
244
- $info['stock'] = $stock;
245
- } catch(Exception $e){
246
- // pass
247
- }
248
 
249
  } catch(Exception $e){
250
  $info = false;
@@ -254,52 +254,145 @@ class Ometria_Api_Model_Api extends Mage_Api_Model_Resource_Abstract {
254
  return $ret;
255
  }
256
 
257
- private function _load_product_rewrites($ids){
258
- if (!$ids) return array();
259
- try{
260
- $db = Mage::getSingleton('core/resource')->getConnection('core_read');
261
- $core_resource = Mage::getSingleton('core/resource');
262
-
263
- $select = $db->select()
264
- ->from(
265
- array(
266
- 's' => $core_resource->getTableName('core_url_rewrite')
267
- ),
268
- array('store_id', 'product_id','request_path')
269
- )
270
- ->where('product_id IN (?)', $ids)
271
- ->order(new Zend_Db_Expr('category_id IS NOT NULL DESC'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
272
 
273
- $rows = $db->fetchAll($select);
 
 
 
274
 
275
- $ret = array();
 
276
 
277
- $store_url_cache = array();
 
278
 
279
- foreach($rows as $row){
280
- $product_id = $row['product_id'];
281
- $store_id = $row['store_id'];
 
 
282
 
283
- if (!isset($store_url_cache[$store_id])) {
284
- $store_url_cache[$store_id]=Mage::app()
285
- ->getStore($store_id)
286
- ->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
 
 
 
 
 
 
 
 
 
 
 
 
 
287
  }
 
288
 
289
- $store_url = rtrim($store_url_cache[$store_id], '/').'/';
 
290
 
291
- $ret[$product_id][$store_id] = array(
292
- 'store'=>$store_id,
293
- 'url' => $store_url.$row['request_path']
294
- );
 
 
 
295
  }
296
 
297
- return $ret;
298
- } catch (Exception $e) {
299
- return array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
300
  }
301
  }
302
 
 
303
  /**
304
  * API method for listing order increment IDs updated between a provided date range.
305
  *
@@ -344,13 +437,18 @@ class Ometria_Api_Model_Api extends Mage_Api_Model_Resource_Abstract {
344
  $ometria_product_helper = Mage::helper('ometria/product');
345
  $is_sku_mode = $ometria_product_helper->isSkuMode();
346
 
 
 
347
  $m = new Mage_Sales_Model_Order_Api();
348
  $ret = array();
349
  foreach($ids as $id){
350
  try{
351
  $info = $m->info($id);
 
 
 
352
 
353
- if ($is_sku_mode && isset($info['items'])) {
354
  $_items = $info['items'];
355
  $items = array();
356
  foreach($_items as $item){
@@ -359,13 +457,26 @@ class Ometria_Api_Model_Api extends Mage_Api_Model_Resource_Abstract {
359
  $items[] = $item;
360
  }
361
  $info['items'] = $items;
362
- }
363
 
364
  } catch(Exception $e){
365
  $info = false;
366
  }
367
  $ret[$id] = $info;
368
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
369
  return $ret;
370
  }
371
 
@@ -456,4 +567,75 @@ class Ometria_Api_Model_Api extends Mage_Api_Model_Resource_Abstract {
456
 
457
  return array($updatedFrom, $updatedTo, $page, $pageSize);
458
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
459
  }
5
  * Return current Ometria API version
6
  */
7
  public function version(){
8
+ $version = current(Mage::getConfig()->getModuleConfig('Ometria_Api')->version);
9
+ return array("branch"=>"new", "version"=>$version);
10
  }
11
 
12
  public function get_stock_levels($ids){
199
  $product = Mage::getModel('catalog/product');
200
  $productMediaConfig = Mage::getModel('catalog/product_media_config');
201
 
202
+ $attribute_ids_per_store = $this->_getProductAttributeIdAndNameMapping();
203
+ $product_per_store_attributes = $this->_loadProductPerStoreAttributes($ids, $attribute_ids_per_store);
204
 
205
+ $website_store_ids = $this->_getWebsitesIdStoreIdsMapping(null);
206
+
207
+ $parent_product_ids = $this->_getParentProductsMapping($ids);
208
 
209
+ $m = new Mage_Catalog_Model_Product_Api();
210
 
211
  $ret = array();
212
  foreach($ids as $id){
221
 
222
  // Additional code to return parent information if available
223
  if ($info['type'] == "simple"){
224
+ if (isset($parent_product_ids[$id])) {
225
+ $info['parent_product_ids'] = array($parent_product_ids[$id]);
226
  }
227
  }
228
 
229
  // Get Image URL
230
+ // @todo this can be removed and using $listing[0] in future
231
  $product->load($id);
232
  if ($product && $product->getId()==$info['product_id']){
233
  $imageUrl = $productMediaConfig->getMediaUrl($product->getSmallImage());
238
  $info['image_thumb_url'] = $imageUrl;
239
  }
240
 
241
+ $website_ids = $info['websites'];
242
+ $store_ids = $this->_getStoreIdsForWebsiteIds($website_ids, $website_store_ids);
243
+ $info['stores'] = $store_ids;
244
+
245
+ $listings = isset($product_per_store_attributes[$id]) ? $product_per_store_attributes[$id] : array();
246
+ $listings = $this->_resolveStoreListings($listings, $store_ids, $productMediaConfig);
247
+ $info['store_listings'] = $listings;
 
 
 
 
 
 
248
 
249
  } catch(Exception $e){
250
  $info = false;
254
  return $ret;
255
  }
256
 
257
+ // Get list of attribute_id => attribute_code pairs for product attributes we are interested in
258
+ private function _getProductAttributeIdAndNameMapping(){
259
+
260
+ $attribute_codes = array(
261
+ 'name',
262
+ 'status',
263
+ 'visibility',
264
+ 'price',
265
+ 'special_price',
266
+ 'url_path',
267
+ 'image',
268
+ 'small_image',
269
+ 'thumbnail'
270
+ );
271
+
272
+ $db = Mage::getSingleton('core/resource')->getConnection('core_read');
273
+ $core_resource = Mage::getSingleton('core/resource');
274
+
275
+ $select = $db->select()
276
+ ->from(
277
+ array('ea' => $core_resource->getTableName('eav_attribute')),
278
+ array('attribute_id','attribute_code')
279
+ )
280
+ ->joinLeft(
281
+ array('et' => $core_resource->getTableName('eav_entity_type')),
282
+ 'ea.entity_type_id = et.entity_type_id',
283
+ array()
284
+ )
285
+ ->where('ea.attribute_code IN (?)', $attribute_codes)
286
+ ->where('et.entity_type_code = ?', 'catalog_product');
287
+
288
+ $rows = $db->fetchAll($select);
289
+ $ret = array();
290
+
291
+ foreach($rows as $row){
292
+ $ret[$row['attribute_id']] = $row['attribute_code'];
293
+ }
294
+
295
+ return $ret;
296
+ }
297
 
298
+ // Map overridden eav_attributes onto one listing per store
299
+ // using defaults where no override exists for that store
300
+ private function _resolveStoreListings($listings, $store_ids, $productMediaConfig){
301
+ if (!isset($listings[0])) return array();
302
 
303
+ $ret = array();
304
+ $default = $listings[0];
305
 
306
+ $store_url_cache = array();
307
+ $store_currency_cache = array();
308
 
309
+ foreach($store_ids as $store_id){
310
+ $listing = $default;
311
+ if (isset($listings[$store_id])){
312
+ $listing = array_merge($listing, $listings[$store_id]);
313
+ }
314
 
315
+ if (!isset($store_url_cache[$store_id])) {
316
+ $store = Mage::app()->getStore($store_id);
317
+ $store_url_cache[$store_id]= $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
318
+ $store_currency_cache[$store_id] = array($store->getBaseCurrencyCode(), $store->getCurrentCurrencyCode());
319
+ }
320
+
321
+ if (isset($listing['url_path'])){
322
+ $store_base_url = rtrim($store_url_cache[$store_id], '/').'/';
323
+ $listing['url'] = $store_base_url . $listing['url_path'];
324
+ unset($listing['url_path']);
325
+ }
326
+
327
+ $image_keys = array('image','thumbnail','small_image');
328
+ foreach($image_keys as $key){
329
+ if (isset($listing[$key])){
330
+ $listing[$key.'_url'] = $productMediaConfig->getMediaUrl($listing[$key]);
331
+ unset($listing[$key]);
332
  }
333
+ }
334
 
335
+ $store_currency_info = $store_currency_cache[$store_id];
336
+ $listing['store_currency'] = $store_currency_info[1];
337
 
338
+ if (isset($listing['price'])){
339
+ $store_price = Mage::helper('directory')->currencyConvert($listing['price'], $store_currency_info[0], $store_currency_info[1]);
340
+ $listing['store_price'] = $store_price;
341
+ }
342
+ if (isset($listing['special_price'])){
343
+ $store_price = Mage::helper('directory')->currencyConvert($listing['special_price'], $store_currency_info[0], $store_currency_info[1]);
344
+ $listing['store_special_price'] = $store_price;
345
  }
346
 
347
+ $listing['store_id'] = $store_id;
348
+ $ret[] = $listing;
349
+ }
350
+
351
+ return $ret;
352
+ }
353
+
354
+ // For a given list of products load all the per store eav attribute values
355
+ private function _loadProductPerStoreAttributes($ids, $attribute_types){
356
+ if (!$attribute_types) return array();
357
+ $attribute_ids = array_keys($attribute_types);
358
+
359
+ $db = Mage::getSingleton('core/resource')->getConnection('core_read');
360
+ $core_resource = Mage::getSingleton('core/resource');
361
+
362
+ $ret = array();
363
+ $this-> _loadProductPerStoreAttributesValues($ret, $ids, $attribute_types, $db, $core_resource->getTableName('catalog_product_entity_varchar'));
364
+ $this-> _loadProductPerStoreAttributesValues($ret, $ids, $attribute_types, $db, $core_resource->getTableName('catalog_product_entity_decimal'));
365
+ $this-> _loadProductPerStoreAttributesValues($ret, $ids, $attribute_types, $db, $core_resource->getTableName('catalog_product_entity_int'));
366
+
367
+ return $ret;
368
+ }
369
+ private function _loadProductPerStoreAttributesValues(&$ret, $ids, $attribute_types, $db, $table_name){
370
+ if (!$attribute_types) return array();
371
+ $attribute_ids = array_keys($attribute_types);
372
+
373
+ $select = $db->select()
374
+ ->from(
375
+ array(
376
+ 's' => $table_name
377
+ ),
378
+ array('entity_id', 'store_id','attribute_id', 'value')
379
+ )
380
+ ->where('entity_id IN (?)', $ids)
381
+ ->where('attribute_id IN (?)', $attribute_ids);
382
+
383
+ $rows = $db->fetchAll($select);
384
+
385
+ foreach($rows as $row){
386
+ $product_id = $row['entity_id'];
387
+ $attribute_id = $row['attribute_id'];
388
+ $key = $attribute_types[$attribute_id];
389
+ $value = $row['value'];
390
+ $store_id = $row['store_id'];
391
+ $ret[$product_id][$store_id][$key] = $value;
392
  }
393
  }
394
 
395
+
396
  /**
397
  * API method for listing order increment IDs updated between a provided date range.
398
  *
437
  $ometria_product_helper = Mage::helper('ometria/product');
438
  $is_sku_mode = $ometria_product_helper->isSkuMode();
439
 
440
+ $lineitem_product_ids = array();
441
+
442
  $m = new Mage_Sales_Model_Order_Api();
443
  $ret = array();
444
  foreach($ids as $id){
445
  try{
446
  $info = $m->info($id);
447
+ foreach($info['items'] as $item){
448
+ $lineitem_product_ids[] = $item['product_id'];
449
+ }
450
 
451
+ /*if ($is_sku_mode && isset($info['items'])) {
452
  $_items = $info['items'];
453
  $items = array();
454
  foreach($_items as $item){
457
  $items[] = $item;
458
  }
459
  $info['items'] = $items;
460
+ }*/
461
 
462
  } catch(Exception $e){
463
  $info = false;
464
  }
465
  $ret[$id] = $info;
466
  }
467
+
468
+ $lineitem_product_ids = array_values(array_unique($lineitem_product_ids));
469
+ $parent_product_ids = $this->_getParentProductsMapping($lineitem_product_ids);
470
+
471
+ foreach($ids as $id){
472
+ for($i=0;$i<count($ret[$id]['items']);$i++){
473
+ $item = $ret[$id]['items'][$i];
474
+ $product_id = $item['product_id'];
475
+ $parent_product_id = isset($parent_product_ids[$product_id]) ? $parent_product_ids[$product_id] : null;
476
+ $ret[$id]['items'][$i]['parent_product_id'] = $parent_product_id;
477
+ }
478
+ }
479
+
480
  return $ret;
481
  }
482
 
567
 
568
  return array($updatedFrom, $updatedTo, $page, $pageSize);
569
  }
570
+
571
+ private function _getWebsitesIdStoreIdsMapping($website_ids){
572
+
573
+ $db = Mage::getSingleton('core/resource')->getConnection('core_read');
574
+ $core_resource = Mage::getSingleton('core/resource');
575
+
576
+ $select = $db->select()
577
+ ->from(
578
+ array(
579
+ 's' => $core_resource->getTableName('core_store')
580
+ ),
581
+ array(
582
+ 'store_id',
583
+ 'website_id'
584
+ )
585
+ );
586
+
587
+ if (is_array($website_ids) && $website_ids){
588
+ $select->where('website_id IN (?)', $website_ids);
589
+ }
590
+
591
+ $rows = $db->fetchAll($select);
592
+ $ret = array();
593
+
594
+ foreach($rows as $row){
595
+ $website_id = $row['website_id'];
596
+ $store_id = $row['store_id'];
597
+
598
+ if (!isset($ret[$website_id])) $ret[$website_id] = array();
599
+ $ret[$website_id][] = $store_id;
600
+ }
601
+
602
+ return $ret;
603
+ }
604
+
605
+ private function _getStoreIdsForWebsiteIds($website_ids, $website_store_ids){
606
+ $ret = array();
607
+ foreach($website_ids as $website_id){
608
+ if (isset($website_store_ids[$website_id])) {
609
+ $ret = array_merge($ret, $website_store_ids[$website_id]);
610
+ }
611
+ }
612
+ return $ret;
613
+ }
614
+
615
+ private function _getParentProductsMapping($product_ids){
616
+ if (!$product_ids) return array();
617
+
618
+ $db = Mage::getSingleton('core/resource')->getConnection('core_read');
619
+ $core_resource = Mage::getSingleton('core/resource');
620
+
621
+ $select = $db->select()
622
+ ->from(
623
+ array('r' => $core_resource->getTableName('catalog_product_relation')),
624
+ array('parent_id','child_id')
625
+ )
626
+ ->join(
627
+ array('p'=>$core_resource->getTableName('catalog_product_entity')),
628
+ 'p.entity_id=r.parent_id'
629
+ )
630
+ ->where('r.child_id IN (?)', $product_ids)
631
+ ->where('p.type_id=?', 'configurable');
632
+ $rows = $db->fetchAll($select);
633
+
634
+ $ret = array();
635
+ foreach($rows as $row) {
636
+ $ret[$row['child_id']] = $row['parent_id'];
637
+ }
638
+
639
+ return $ret;
640
+ }
641
  }
app/code/community/Ometria/Api/Model/Api2.php CHANGED
@@ -2,6 +2,75 @@
2
  class Ometria_Api_Model_Api2 extends Mage_Api_Model_Resource_Abstract {
3
 
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  public function customers_list($filters, $page = null, $limit = null, $attributes=array('*')) {
6
 
7
  $collection = Mage::getModel('customer/customer')
@@ -328,6 +397,35 @@ class Ometria_Api_Model_Api2 extends Mage_Api_Model_Resource_Abstract {
328
  return $db->fetchAll($select);
329
  }
330
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
331
  public function salesrules_create_coupons($rule_id, $count=1, $parameters=array()){
332
  // Get the rule in question
333
  $rule = Mage::getModel('salesrule/rule')->load($rule_id);
@@ -373,15 +471,81 @@ class Ometria_Api_Model_Api2 extends Mage_Api_Model_Resource_Abstract {
373
  // Get as many coupons as you required
374
  $codes = array();
375
  for( $i = 0; $i < $count; $i++ ){
376
- $coupon = $rule->acquireCoupon();
377
- $coupon->setType(Mage_SalesRule_Helper_Coupon::COUPON_TYPE_SPECIFIC_AUTOGENERATED)->save();
378
- $code = $coupon->getCode();
379
- $codes[] = $code;
 
 
 
 
380
  }
381
  return $codes;
382
  }
383
 
384
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
385
  public function stores_list($filters=array()){
386
  $db = Mage::getSingleton('core/resource')->getConnection('core_read');
387
  $core_resource = Mage::getSingleton('core/resource');
@@ -985,6 +1149,14 @@ class Ometria_Api_Model_Api2 extends Mage_Api_Model_Resource_Abstract {
985
  $info['timezone'] = Mage::getStoreConfig('general/locale/timezone');
986
  $info['php_timezone'] = date_default_timezone_get();
987
  $info['php_version'] = phpversion();
 
 
 
 
 
 
 
 
988
 
989
  return $info;
990
  }
@@ -1085,4 +1257,62 @@ class Ometria_Api_Model_Api2 extends Mage_Api_Model_Resource_Abstract {
1085
 
1086
  return $store_ids;
1087
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1088
  }
2
  class Ometria_Api_Model_Api2 extends Mage_Api_Model_Resource_Abstract {
3
 
4
 
5
+ public function stock_list($filters, $page = null, $limit = null){
6
+ $db = $this->_getReadDb();
7
+ $core_resource = Mage::getSingleton('core/resource');
8
+
9
+ $website_store_lookup = $this->_getWebsitesIdStoreIdsMapping(null);
10
+
11
+ $select = $db->select()
12
+ ->from(
13
+ array(
14
+ 'ss' => $core_resource->getTableName('cataloginventory_stock_status')
15
+ ),
16
+ array('*')
17
+ )
18
+ ->joinLeft(
19
+ array(
20
+ 'r' => $core_resource->getTableName('catalog_product_relation')
21
+ ),
22
+ 'r.child_id = ss.product_id',
23
+ array(
24
+ 'parent_id'=>'parent_id'
25
+ )
26
+ )
27
+ ->join(
28
+ array(
29
+ 'p' => $core_resource->getTableName('catalog_product_entity')
30
+ ),
31
+ 'p.entity_id = ss.product_id',
32
+ array(
33
+ 'sku'=>'sku',
34
+ 'product_type_id'=>'type_id'
35
+ )
36
+ );
37
+
38
+ if (array_key_exists('stock_status', $filters)) {
39
+ $select->where('ss.stock_status=?', $filters['stock_status']);
40
+ }
41
+
42
+ // Expand to include child products if 'fetch_children' is given
43
+ if (isset($filters['id']) && $filters['id'] && isset($filters['fetch_children']) && $filters['fetch_children']){
44
+ $product_ids = $filters['id'];
45
+ if (!is_array($product_ids)) $product_ids = array($product_ids);
46
+
47
+ $product_child_ids = $this->_getChildProductIdsFor($product_ids);
48
+ $product_ids = array_merge($product_ids, $product_child_ids);
49
+ $filters['id'] = $product_ids;
50
+ }
51
+
52
+ if (isset($filters['id']) && $filters['id']){
53
+ $product_ids = $filters['id'];
54
+ if (!is_array($product_ids)) $product_ids = array($product_ids);
55
+ $select->where('product_id IN (?)', $product_ids);
56
+ }
57
+
58
+ if ($limit && $page) {
59
+ $offset = ($page-1)*$limit;
60
+ $select->limit($limit, $offset);
61
+ }
62
+
63
+ $rows = $db->fetchAll($select);
64
+ $ret = array();
65
+ foreach($rows as $row){
66
+ $website_id = $row['website_id'];
67
+ $row['store_ids'] = isset($website_store_lookup[$website_id]) ? $website_store_lookup[$website_id] : array();
68
+ $ret[] = $row;
69
+ }
70
+
71
+ return $ret;
72
+ }
73
+
74
  public function customers_list($filters, $page = null, $limit = null, $attributes=array('*')) {
75
 
76
  $collection = Mage::getModel('customer/customer')
397
  return $db->fetchAll($select);
398
  }
399
 
400
+
401
+ public function salesrules_create_specific_coupons($rule_id, $requested_codes=array()){
402
+ // Get the rule in question
403
+ $rule = Mage::getModel('salesrule/rule')->load($rule_id);
404
+ if (!$rule->getId()) return false;
405
+ if (!$requested_codes) return false;
406
+
407
+ $generator = new Ometria_Api_Model_FixedCouponGenerator();
408
+
409
+ // Set the generator, and coupon type so it's able to generate
410
+ $rule->setCouponCodeGenerator($generator);
411
+ $rule->setCouponType( Mage_SalesRule_Model_Rule::COUPON_TYPE_AUTO );
412
+
413
+ // Get as many coupons as you required
414
+ $codes = array();
415
+ foreach($requested_codes as $requested_code){
416
+ try{
417
+ $generator->setNextCode($requested_code);
418
+ $coupon = $rule->acquireCoupon();
419
+ $coupon->setType(Mage_SalesRule_Helper_Coupon::COUPON_TYPE_SPECIFIC_AUTOGENERATED)->save();
420
+ $code = $coupon->getCode();
421
+ $codes[] = $code;
422
+ } catch(Exception $e) {
423
+ //pass
424
+ }
425
+ }
426
+ return $codes;
427
+ }
428
+
429
  public function salesrules_create_coupons($rule_id, $count=1, $parameters=array()){
430
  // Get the rule in question
431
  $rule = Mage::getModel('salesrule/rule')->load($rule_id);
471
  // Get as many coupons as you required
472
  $codes = array();
473
  for( $i = 0; $i < $count; $i++ ){
474
+ try{
475
+ $coupon = $rule->acquireCoupon();
476
+ $coupon->setType(Mage_SalesRule_Helper_Coupon::COUPON_TYPE_SPECIFIC_AUTOGENERATED)->save();
477
+ $code = $coupon->getCode();
478
+ $codes[] = $code;
479
+ } catch(Exception $e) {
480
+ //pass
481
+ }
482
  }
483
  return $codes;
484
  }
485
 
486
 
487
+
488
+ public function salesrules_insert_coupons($rule_id, $coupon_codes, $parameters=array()){
489
+ // Get the rule in question
490
+ $rule = Mage::getModel('salesrule/rule')->load($rule_id);
491
+ if (!$rule->getId()) return false;
492
+
493
+ $coupon = Mage::getModel('salesrule/coupon');
494
+
495
+ $expiration_date = null;
496
+ if (isset($parameters['expiry_days'])) {
497
+ $expiry_days = intval($parameters['expiry_days']);
498
+ $expire_ts = strtotime('+'.$expiry_days.' days');
499
+ $expiration_date = date('Y-m-d H:i:s', $expire_ts);
500
+ }
501
+
502
+ $usage_per_customer = isset($parameters['usage_per_customer']) ? $parameters['usage_per_customer'] : null;
503
+ $usage_limit = isset($parameters['usage_limit']) ? $parameters['usage_limit'] : 1;
504
+
505
+ $created_coupon_codes = array();
506
+
507
+ foreach($coupon_codes as $code){
508
+ try{
509
+ $coupon->setId(null)
510
+ ->setRuleId($rule->getRuleId())
511
+ ->setCode($code)
512
+ ->setUsageLimit($usage_limit)
513
+ ->setUsagePerCustomer($usage_per_customer)
514
+ ->setExpirationDate($expiration_date)
515
+ //->setIsPrimary(1)
516
+ ->setCreatedAt(time())
517
+ ->setType(Mage_SalesRule_Helper_Coupon::COUPON_TYPE_SPECIFIC_AUTOGENERATED)
518
+ ->save();
519
+ $created_coupon_codes[] = $code;
520
+ } catch(Exception $e){
521
+ // pass
522
+ }
523
+ }
524
+
525
+ return $created_coupon_codes;
526
+ }
527
+
528
+
529
+ public function salesrules_remove_expired_coupons($rule_id){
530
+ // Get the rule in question
531
+ $rule = Mage::getModel('salesrule/rule')->load($rule_id);
532
+ if (!$rule->getId()) return false;
533
+
534
+ $coupons = Mage::getModel('salesrule/coupon')
535
+ ->getCollection()
536
+ ->addFieldToSelect('*')
537
+ ->addFieldToFilter('rule_id', array('eq' => $rule_id))
538
+ ->addFieldToFilter('expiration_date', array('lt' => date('Y-m-d H:i:s')));
539
+
540
+ $removed_codes = array();
541
+ foreach($coupons as $coupon){
542
+ $removed_codes[] = $coupon->getCode();
543
+ $coupon->delete();
544
+ }
545
+
546
+ return $removed_codes;
547
+ }
548
+
549
  public function stores_list($filters=array()){
550
  $db = Mage::getSingleton('core/resource')->getConnection('core_read');
551
  $core_resource = Mage::getSingleton('core/resource');
1149
  $info['timezone'] = Mage::getStoreConfig('general/locale/timezone');
1150
  $info['php_timezone'] = date_default_timezone_get();
1151
  $info['php_version'] = phpversion();
1152
+ $info['magento_version'] = Mage::getVersion();
1153
+
1154
+ $modules = array('Ometria_Api','Ometria_Core','Ometria_AbandonedCarts');
1155
+ $info['ometria_extension_versions'] = array();
1156
+ foreach($modules as $module){
1157
+ $info['ometria_extension_versions'][$module]
1158
+ = current(Mage::getConfig()->getModuleConfig($module)->version);
1159
+ }
1160
 
1161
  return $info;
1162
  }
1257
 
1258
  return $store_ids;
1259
  }
1260
+
1261
+ private function _getWebsitesIdStoreIdsMapping($website_ids){
1262
+
1263
+ $db = Mage::getSingleton('core/resource')->getConnection('core_read');
1264
+ $core_resource = Mage::getSingleton('core/resource');
1265
+
1266
+ $select = $db->select()
1267
+ ->from(
1268
+ array(
1269
+ 's' => $core_resource->getTableName('core_store')
1270
+ ),
1271
+ array(
1272
+ 'store_id',
1273
+ 'website_id'
1274
+ )
1275
+ );
1276
+
1277
+ if (is_array($website_ids) && $website_ids){
1278
+ $select->where('website_id IN (?)', $website_ids);
1279
+ }
1280
+
1281
+ $rows = $db->fetchAll($select);
1282
+ $ret = array();
1283
+
1284
+ foreach($rows as $row){
1285
+ $website_id = $row['website_id'];
1286
+ $store_id = $row['store_id'];
1287
+
1288
+ if (!isset($ret[$website_id])) $ret[$website_id] = array();
1289
+ $ret[$website_id][] = $store_id;
1290
+ }
1291
+
1292
+ return $ret;
1293
+ }
1294
+
1295
+ private function _getChildProductIdsFor($product_ids){
1296
+
1297
+ if (!$product_ids) return array();
1298
+
1299
+ $db = Mage::getSingleton('core/resource')->getConnection('core_read');
1300
+ $core_resource = Mage::getSingleton('core/resource');
1301
+
1302
+ $select = $db->select()
1303
+ ->from(
1304
+ array(
1305
+ 'r' => $core_resource->getTableName('catalog_product_relation')
1306
+ ),
1307
+ array(
1308
+ 'child_id',
1309
+ )
1310
+ )
1311
+ ->where('parent_id IN (?)', $product_ids);
1312
+
1313
+ $rows = $db->fetchAll($select);
1314
+ $child_ids = array();
1315
+ foreach($rows as $row) $child_ids[] = $row['child_id'];
1316
+ return $child_ids;
1317
+ }
1318
  }
app/code/community/Ometria/Api/Model/FixedCouponGenerator.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ometria_Api_Model_FixedCouponGenerator extends Mage_SalesRule_Model_Coupon_Massgenerator{
4
+
5
+ protected $code = null;
6
+
7
+ public function setNextCode($code){
8
+ $this->code = $code;
9
+ }
10
+
11
+ public function generateCode(){
12
+ return $this->code;
13
+ }
14
+ }
app/code/community/Ometria/Api/etc/api.xml CHANGED
@@ -81,6 +81,10 @@
81
  <title>Ometria API version 2</title>
82
  <model>ometria_api/api2</model>
83
  <methods>
 
 
 
 
84
  <get_magento_info translate="title" module="ometria_api">
85
  <title>Get Magento instance info</title>
86
  <acl>ometria_api/read</acl>
@@ -146,6 +150,18 @@
146
  <title>Create cart sales rule coupons</title>
147
  <acl>ometria_api/create_coupon</acl>
148
  </salesrules_create_coupons>
 
 
 
 
 
 
 
 
 
 
 
 
149
 
150
  <subscribers_subscribe translate="title" module="ometria_api">
151
  <title>Add subscribers</title>
81
  <title>Ometria API version 2</title>
82
  <model>ometria_api/api2</model>
83
  <methods>
84
+ <stock_list translate="title" module="ometria_api">
85
+ <title>Get full stock dump</title>
86
+ <acl>ometria_api/read</acl>
87
+ </stock_list>
88
  <get_magento_info translate="title" module="ometria_api">
89
  <title>Get Magento instance info</title>
90
  <acl>ometria_api/read</acl>
150
  <title>Create cart sales rule coupons</title>
151
  <acl>ometria_api/create_coupon</acl>
152
  </salesrules_create_coupons>
153
+ <salesrules_create_specific_coupons translate="title" module="ometria_api">
154
+ <title>Create cart sales rule coupons with specific codes</title>
155
+ <acl>ometria_api/create_coupon</acl>
156
+ </salesrules_create_specific_coupons>
157
+ <salesrules_insert_coupons translate="title" module="ometria_api">
158
+ <title>Insert existing cart sales rule coupons</title>
159
+ <acl>ometria_api/create_coupon</acl>
160
+ </salesrules_insert_coupons>
161
+ <salesrules_remove_expired_coupons translate="title" module="ometria_api">
162
+ <title>Remove expired coupons from sales rule</title>
163
+ <acl>ometria_api/create_coupon</acl>
164
+ </salesrules_remove_expired_coupons>
165
 
166
  <subscribers_subscribe translate="title" module="ometria_api">
167
  <title>Add subscribers</title>
app/code/community/Ometria/Api/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Ometria_Api>
5
- <version>1.0.0</version>
6
  </Ometria_Api>
7
  </modules>
8
 
2
  <config>
3
  <modules>
4
  <Ometria_Api>
5
+ <version>1.1.0</version>
6
  </Ometria_Api>
7
  </modules>
8
 
app/code/community/Ometria/Core/Helper/Cookiechannel.php CHANGED
@@ -9,6 +9,10 @@ class Ometria_Core_Helper_Cookiechannel extends Mage_Core_Helper_Abstract {
9
  public function addCommand($command, $replace_if_exists=false){
10
  if (!$command || !is_array($command)) return;
11
 
 
 
 
 
12
  $ometria_config_helper = Mage::helper('ometria/config');
13
  if (!$ometria_config_helper->isConfigured()) return;
14
  if (!$ometria_config_helper->isUnivarEnabled()) return;
9
  public function addCommand($command, $replace_if_exists=false){
10
  if (!$command || !is_array($command)) return;
11
 
12
+ // Return if admin area or API call
13
+ if (Mage::app()->getStore()->isAdmin()) return;
14
+ if (Mage::getSingleton('api/server')->getAdapter() != null) return;
15
+
16
  $ometria_config_helper = Mage::helper('ometria/config');
17
  if (!$ometria_config_helper->isConfigured()) return;
18
  if (!$ometria_config_helper->isUnivarEnabled()) return;
app/code/community/Ometria/Core/Model/Observer/Cart.php CHANGED
@@ -2,7 +2,12 @@
2
 
3
  class Ometria_Core_Model_Observer_Cart {
4
 
 
5
  public function basketUpdated(Varien_Event_Observer $observer){
 
 
 
 
6
  $this->updateBasketCookie();
7
  }
8
 
@@ -12,7 +17,7 @@ class Ometria_Core_Model_Observer_Cart {
12
  $ometria_cookiechannel_helper = Mage::helper('ometria/cookiechannel');
13
  $cart = Mage::getModel('checkout/cart')->getQuote();
14
 
15
- $cart_token = md5($cart->created_at.$cart->remote_ip);
16
 
17
  $command = array(
18
  'basket',
@@ -29,8 +34,9 @@ class Ometria_Core_Model_Observer_Cart {
29
  $buffer = array(
30
  'i'=>$ometria_product_helper->getIdentifierForProduct($product),
31
  //'s'=>$product->getSku(),
32
- //'v'=>$item->getSku(),
33
- 'q'=>$item->getQty(),
 
34
  );
35
  $command_part = http_build_query($buffer);
36
  $command[] = $command_part;
@@ -41,6 +47,14 @@ class Ometria_Core_Model_Observer_Cart {
41
 
42
  $ometria_cookiechannel_helper->addCommand($command, true);
43
 
 
 
 
 
 
 
 
 
44
  return $this;
45
  }
46
 
@@ -56,8 +70,27 @@ class Ometria_Core_Model_Observer_Cart {
56
  if ($session_id) {
57
  $ometria_ping_helper->sendPing('transaction', $order->getIncrementId(), array('session'=>$session_id));
58
  }
59
-
60
  $ometria_cookiechannel_helper->addCommand(array('trans', $order->getIncrementId()));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  } catch(Exception $e){
62
  //pass
63
  }
2
 
3
  class Ometria_Core_Model_Observer_Cart {
4
 
5
+
6
  public function basketUpdated(Varien_Event_Observer $observer){
7
+ // Return if admin area or API call
8
+ if (Mage::app()->getStore()->isAdmin()) return;
9
+ if (Mage::getSingleton('api/server')->getAdapter() != null) return;
10
+
11
  $this->updateBasketCookie();
12
  }
13
 
17
  $ometria_cookiechannel_helper = Mage::helper('ometria/cookiechannel');
18
  $cart = Mage::getModel('checkout/cart')->getQuote();
19
 
20
+ $cart_token = substr(md5($cart->created_at.$cart->getId()),0,12);
21
 
22
  $command = array(
23
  'basket',
34
  $buffer = array(
35
  'i'=>$ometria_product_helper->getIdentifierForProduct($product),
36
  //'s'=>$product->getSku(),
37
+ 'v'=>$item->getSku(),
38
+ 'q'=>(int) $item->getQty(),
39
+ 't'=>(float) $item->getRowTotalInclTax()
40
  );
41
  $command_part = http_build_query($buffer);
42
  $command[] = $command_part;
47
 
48
  $ometria_cookiechannel_helper->addCommand($command, true);
49
 
50
+ // Identify if needed
51
+ if ($cart->getCustomerEmail()) {
52
+ $identify_type = 'checkout_billing';
53
+ $data = array('e'=>$cart->getCustomerEmail());
54
+ $command = array('identify', $identify_type, http_build_query($data));
55
+ $ometria_cookiechannel_helper->addCommand($command, true);
56
+ }
57
+
58
  return $this;
59
  }
60
 
70
  if ($session_id) {
71
  $ometria_ping_helper->sendPing('transaction', $order->getIncrementId(), array('session'=>$session_id));
72
  }
 
73
  $ometria_cookiechannel_helper->addCommand(array('trans', $order->getIncrementId()));
74
+
75
+ // If via front end, also identify via cookie channel (but do not replace if customer login has done it)
76
+ $is_frontend = true;
77
+ if (Mage::app()->getStore()->isAdmin()) $is_frontend=false;
78
+ if (Mage::getSingleton('api/server')->getAdapter() != null) $is_frontend=false;
79
+ if ($is_frontend){
80
+ $ometria_cookiechannel_helper = Mage::helper('ometria/cookiechannel');
81
+
82
+ if ($order->getCustomerIsGuest()){
83
+ $identify_type = 'guest_checkout';
84
+ $data = array('e'=>$order->getCustomerEmail());
85
+ } else {
86
+ $identify_type = 'checkout';
87
+ $customer = $order->getCustomer();
88
+ $data = array('e'=>$customer->getEmail(),'i'=>$customer->getId());
89
+ }
90
+
91
+ $command = array('identify', $identify_type, http_build_query($data));
92
+ $ometria_cookiechannel_helper->addCommand($command, true);
93
+ }
94
  } catch(Exception $e){
95
  //pass
96
  }
app/code/community/Ometria/Core/Model/Observer/Newsletter.php CHANGED
@@ -14,10 +14,21 @@ class Ometria_Core_Model_Observer_Newsletter {
14
  $event = null;
15
  if ($data['subscriber_status']==1) $event = 'newsletter_subscribed';
16
  if ($data['subscriber_status']==3) $event = 'newsletter_unsubscribed';
17
- if ($event) $ometria_ping_helper->sendPing($event, $subscriber->getEmail());
18
 
19
  // Update timestamp column
20
- $subscriber->change_status_at = time();
 
 
 
 
 
 
 
 
 
 
 
21
  }
22
  }
23
 
14
  $event = null;
15
  if ($data['subscriber_status']==1) $event = 'newsletter_subscribed';
16
  if ($data['subscriber_status']==3) $event = 'newsletter_unsubscribed';
17
+ if ($event) $ometria_ping_helper->sendPing($event, $subscriber->getEmail(), array('store_id'=>$subscriber->store_id));
18
 
19
  // Update timestamp column
20
+ $subscriber->change_status_at = date("Y-m-d H:i:s", time());
21
+ }
22
+
23
+ // If via front end, also identify via cookie channel (but do not replace if customer login has done it)
24
+ $is_frontend = true;
25
+ if (Mage::app()->getStore()->isAdmin()) $is_frontend=false;
26
+ if (Mage::getSingleton('api/server')->getAdapter() != null) $is_frontend=false;
27
+ if ($is_frontend){
28
+ $ometria_cookiechannel_helper = Mage::helper('ometria/cookiechannel');
29
+ $data = array('e'=>$subscriber->getEmail());
30
+ $command = array('identify', 'newsletter', http_build_query($data));
31
+ $ometria_cookiechannel_helper->addCommand($command, false);
32
  }
33
  }
34
 
app/code/community/Ometria/Core/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Ometria_Core>
5
- <version>1.0.0</version>
6
  </Ometria_Core>
7
  </modules>
8
 
@@ -77,25 +77,15 @@
77
  </ometria_customer_save_after>
78
  </observers>
79
  </customer_save_after>
80
- <checkout_cart_add_product_complete>
81
  <observers>
82
- <checkout_cart_update_item_complete>
83
  <type>singleton</type>
84
  <class>ometria/observer_cart</class>
85
  <method>basketUpdated</method>
86
- </checkout_cart_update_item_complete>
87
  </observers>
88
- </checkout_cart_add_product_complete>
89
- <sales_quote_remove_item>
90
- <observers>
91
- <ometria_sales_quote_remove_item>
92
- <type>singleton</type>
93
- <class>ometria/observer_cart</class>
94
- <method>basketUpdated</method>
95
- </ometria_sales_quote_remove_item>
96
- </observers>
97
- </sales_quote_remove_item>
98
-
99
  <customer_login>
100
  <observers>
101
  <ometria_customer_login>
2
  <config>
3
  <modules>
4
  <Ometria_Core>
5
+ <version>1.1.0</version>
6
  </Ometria_Core>
7
  </modules>
8
 
77
  </ometria_customer_save_after>
78
  </observers>
79
  </customer_save_after>
80
+ <sales_quote_save_after>
81
  <observers>
82
+ <ometria_sales_quote_save_after>
83
  <type>singleton</type>
84
  <class>ometria/observer_cart</class>
85
  <method>basketUpdated</method>
86
+ </ometria_sales_quote_save_after>
87
  </observers>
88
+ </sales_quote_save_after>
 
 
 
 
 
 
 
 
 
 
89
  <customer_login>
90
  <observers>
91
  <ometria_customer_login>
app/code/community/Ometria/Core/etc/system.xml CHANGED
@@ -30,16 +30,16 @@
30
  <source_model>adminhtml/system_config_source_yesno</source_model>
31
  <sort_order>10</sort_order>
32
  <show_in_default>1</show_in_default>
33
- <show_in_website>0</show_in_website>
34
- <show_in_store>0</show_in_store>
35
  </enabled>
36
  <apikey translate="label" module="ometria">
37
  <label>Ometria Site Identifier</label>
38
  <frontend_type>text</frontend_type>
39
  <sort_order>20</sort_order>
40
  <show_in_default>1</show_in_default>
41
- <show_in_website>0</show_in_website>
42
- <show_in_store>0</show_in_store>
43
  <comment>
44
  <![CDATA[Sign up for an account at <a href="http://www.ometria.com/" target="_blank">Ometria.com</a>]]>
45
  </comment>
@@ -63,8 +63,8 @@
63
  <frontend_type>text</frontend_type>
64
  <sort_order>30</sort_order>
65
  <show_in_default>1</show_in_default>
66
- <show_in_website>0</show_in_website>
67
- <show_in_store>0</show_in_store>
68
  <fields>
69
  <univar translate="label" module="ometria">
70
  <label>Include Data Layer</label>
@@ -72,8 +72,8 @@
72
  <source_model>adminhtml/system_config_source_yesno</source_model>
73
  <sort_order>10</sort_order>
74
  <show_in_default>1</show_in_default>
75
- <show_in_website>0</show_in_website>
76
- <show_in_store>0</show_in_store>
77
  </univar>
78
  <ping translate="label" module="ometria">
79
  <label>Ping Ometria on record update</label>
@@ -90,8 +90,8 @@
90
  <source_model>adminhtml/system_config_source_yesno</source_model>
91
  <sort_order>12</sort_order>
92
  <show_in_default>1</show_in_default>
93
- <show_in_website>0</show_in_website>
94
- <show_in_store>0</show_in_store>
95
  </scriptload>
96
  <debug translate="label" module="ometria">
97
  <label>Debug Mode</label>
30
  <source_model>adminhtml/system_config_source_yesno</source_model>
31
  <sort_order>10</sort_order>
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
  </enabled>
36
  <apikey translate="label" module="ometria">
37
  <label>Ometria Site Identifier</label>
38
  <frontend_type>text</frontend_type>
39
  <sort_order>20</sort_order>
40
  <show_in_default>1</show_in_default>
41
+ <show_in_website>1</show_in_website>
42
+ <show_in_store>1</show_in_store>
43
  <comment>
44
  <![CDATA[Sign up for an account at <a href="http://www.ometria.com/" target="_blank">Ometria.com</a>]]>
45
  </comment>
63
  <frontend_type>text</frontend_type>
64
  <sort_order>30</sort_order>
65
  <show_in_default>1</show_in_default>
66
+ <show_in_website>1</show_in_website>
67
+ <show_in_store>1</show_in_store>
68
  <fields>
69
  <univar translate="label" module="ometria">
70
  <label>Include Data Layer</label>
72
  <source_model>adminhtml/system_config_source_yesno</source_model>
73
  <sort_order>10</sort_order>
74
  <show_in_default>1</show_in_default>
75
+ <show_in_website>1</show_in_website>
76
+ <show_in_store>1</show_in_store>
77
  </univar>
78
  <ping translate="label" module="ometria">
79
  <label>Ping Ometria on record update</label>
90
  <source_model>adminhtml/system_config_source_yesno</source_model>
91
  <sort_order>12</sort_order>
92
  <show_in_default>1</show_in_default>
93
+ <show_in_website>1</show_in_website>
94
+ <show_in_store>1</show_in_store>
95
  </scriptload>
96
  <debug translate="label" module="ometria">
97
  <label>Debug Mode</label>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Ometria_Magento_Extension</name>
4
- <version>1.0.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Source License (OSL)</license>
7
  <channel>community</channel>
@@ -21,11 +21,13 @@ Enough Data already. Tell me what to do!&#xD;
21
  We don't just pull the right data together in one place, we also create insights. Our team of data scientists have created a set of algorithms to spot weaknesses, under-performance and opportunities, so every time a retailer logs into their dashboards we present a short list of top revenue wins.&#xD;
22
  &#xD;
23
  Whether it's with our multi-dimension funnel analysis which flags up specific channels that may be under-performing, or our customer dashboard which spots channels that deliver customers with the best CLV, our 'actionable insights' come ready to go.</description>
24
- <notes>Release of new extension.</notes>
 
 
25
  <authors><author><name>Alastair James</name><user>aljames1981</user><email>al.james@gmail.com</email></author></authors>
26
- <date>2015-05-19</date>
27
- <time>12:47:49</time>
28
- <contents><target name="magecommunity"><dir name="Ometria"><dir name="AbandonedCarts"><dir name="Helper"><file name="Config.php" hash="4ea2f9de193a510a1438a1911f6e9a8d"/><file name="Data.php" hash="1348c35f00b49b2b30034f0d9a819ae8"/></dir><dir name="controllers"><file name="CartlinkController.php" hash="d1cd8ca0cd5d40f1fbfcd53408d9ee05"/></dir><dir name="etc"><file name="config.xml" hash="c750ffe30696d51f7f7c0a9f5544093a"/><file name="system.xml" hash="11db59f5c2f864525e4c1cdd06283ac1"/></dir></dir><dir name="Api"><dir name="Helper"><file name="Data.php" hash="8a19a3bf39de93fab7d2e1333c3c0806"/></dir><dir name="Model"><file name="Api.php" hash="3cc250c379ef7a1e1eaf9baa927f4160"/><file name="Api2.php" hash="78cdf93358b28283e3aeb9e6760add24"/></dir><dir name="etc"><file name="api.xml" hash="aa0983d987856273a6f1482dea45984e"/><file name="config.xml" hash="33cf63ddeefdf62bd9d8c7a0e0c44040"/></dir></dir><dir name="Core"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="Startwizard.php" hash="48c0cc3736f8a7fbd871d92d1aed9a81"/></dir></dir><dir name="Wizard"><file name="Finished.php" hash="3325319ce22b23c3661a15b7ab6cbb83"/><dir name="Start"><file name="Form.php" hash="e5d6f86a9718da044104245b46230674"/></dir><file name="Start.php" hash="befc4575e361b7a9916f929e2fc58c45"/></dir></dir><file name="Head.php" hash="1b00336f0bd24d46c56b6ced4c0515a6"/></dir><dir name="Helper"><file name="Config.php" hash="1a9c4653ff34de123dbab505687265a7"/><file name="Cookiechannel.php" hash="309ff2e6d5cb721d1bbc04f18156f35e"/><file name="Data.php" hash="26c20107047db9e3911118efbf083135"/><file name="Ping.php" hash="0eba99b10b71c666cecd95ddaef69df3"/><file name="Product.php" hash="60e3b6bcb43884af7e4a4ed48c3e3411"/><file name="Session.php" hash="798245d7d20c523b3c386c8bf25979d2"/></dir><dir name="Model"><dir name="Config"><dir name="Source"><file name="Productmode.php" hash="3b37b999e8d49fc23af6229bcae86bb9"/></dir></dir><dir name="Observer"><file name="Cart.php" hash="5fb4a3a7d8cf7e162fdfda0b183f8426"/><file name="Customer.php" hash="3e36530a774e2f9af9adbbb581f52380"/><file name="Newsletter.php" hash="a262a42d8a6d4d07ad475cca5fdf6c76"/><file name="Order.php" hash="fdcbad1124492f520b9edb72e0d88463"/><file name="Product.php" hash="e988fbf3dcf5ef6ea898b2668f2c4f55"/></dir><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="Test"><dir name="Config"><file name="Base.php" hash="997583679f0981fbd2f0560cf40855d1"/></dir><dir name="Model"><dir name="Observer"><file name="Order.php" hash="d4655e7789a87b3fe8093355e862bfc4"/><file name="Product.php" hash="b9d3920d0d489c39245f747f15187085"/></dir></dir></dir><dir name="controllers"><file name="WizardController.php" hash="558e829a66e2ad9a7b7c1ad9d7d4a530"/></dir><dir name="etc"><file name="config.xml" hash="74856c866f046115fcf56c5c076d5e8b"/><file name="system.xml" hash="5e4286f048a66333776441737bf5b54b"/></dir><file name=".DS_Store" hash="d8b910e9c4677fce43c430c2bb123061"/></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="ometria"><file name="core.xml" hash="d8d696fec5b40262b9307a0bb89bcede"/></dir></dir><dir name="template"><dir name="ometria"><file name="head.phtml" hash="1ef17e826431c85e14532d7660b38ee8"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="ometria"><file name="core.xml" hash="4fd702d8159187002eebb40c9b3ebe1b"/></dir></dir><dir name="template"><dir name="ometria"><dir name="system"><dir name="config"><file name="start_wizard.phtml" hash="d4a4e6d6ab16048f1e436793cb24a668"/></dir></dir><dir name="wizard"><file name="finished.phtml" hash="e475e0a7fb28b2b054a1b26cae5fd9b8"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ometria_Core.xml" hash="f8ec0ef46b669bf0070d9064300fc0fd"/><file name="Ometria_Api.xml" hash="e9309a378992b51f710a9fca17a3055e"/><file name="Ometria_AbandonedCarts.xml" hash="a69a03804840e784362410c2596c0a08"/></dir></target><target name="mageweb"><dir name="js"><dir name="ometria"><file name="checkout.js" hash="78b5fed53276d65a42c5cad4bf92a35f"/></dir></dir></target></contents>
29
  <compatible/>
30
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
31
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Ometria_Magento_Extension</name>
4
+ <version>1.1.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Source License (OSL)</license>
7
  <channel>community</channel>
21
  We don't just pull the right data together in one place, we also create insights. Our team of data scientists have created a set of algorithms to spot weaknesses, under-performance and opportunities, so every time a retailer logs into their dashboards we present a short list of top revenue wins.&#xD;
22
  &#xD;
23
  Whether it's with our multi-dimension funnel analysis which flags up specific channels that may be under-performing, or our customer dashboard which spots channels that deliver customers with the best CLV, our 'actionable insights' come ready to go.</description>
24
+ <notes>Additional APIS for coupon code generation and stock levels.&#xD;
25
+ &#xD;
26
+ Some small fixes around identification and abandoned baskets.</notes>
27
  <authors><author><name>Alastair James</name><user>aljames1981</user><email>al.james@gmail.com</email></author></authors>
28
+ <date>2015-09-01</date>
29
+ <time>14:14:00</time>
30
+ <contents><target name="magecommunity"><dir name="Ometria"><dir name="AbandonedCarts"><dir name="Helper"><file name="Config.php" hash="4ea2f9de193a510a1438a1911f6e9a8d"/><file name="Data.php" hash="1348c35f00b49b2b30034f0d9a819ae8"/></dir><dir name="controllers"><file name="CartlinkController.php" hash="0116b91a5a5ce16319a7665bb4261fe6"/></dir><dir name="etc"><file name="config.xml" hash="4c0890bac2661dc57c2f55da43948c88"/><file name="system.xml" hash="11db59f5c2f864525e4c1cdd06283ac1"/></dir></dir><dir name="Api"><dir name="Helper"><file name="Data.php" hash="8a19a3bf39de93fab7d2e1333c3c0806"/></dir><dir name="Model"><file name="Api.php" hash="4dba56cef3f7d73084e3475cbf37fdbe"/><file name="Api2.php" hash="e34e5530d8e828fcdb2ce09f6abef01d"/><file name="FixedCouponGenerator.php" hash="b37f5df7471dca9437a7aed70b4c53c0"/></dir><dir name="etc"><file name="api.xml" hash="51d02f0154ac396ef90f4ff484253af3"/><file name="config.xml" hash="ab7558111825f13a70d1279d2ab381cc"/></dir></dir><dir name="Core"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="Startwizard.php" hash="48c0cc3736f8a7fbd871d92d1aed9a81"/></dir></dir><dir name="Wizard"><file name="Finished.php" hash="3325319ce22b23c3661a15b7ab6cbb83"/><dir name="Start"><file name="Form.php" hash="e5d6f86a9718da044104245b46230674"/></dir><file name="Start.php" hash="befc4575e361b7a9916f929e2fc58c45"/></dir></dir><file name="Head.php" hash="1b00336f0bd24d46c56b6ced4c0515a6"/></dir><dir name="Helper"><file name="Config.php" hash="1a9c4653ff34de123dbab505687265a7"/><file name="Cookiechannel.php" hash="c3751e4e855b6612e2c4c99feeab4c5e"/><file name="Data.php" hash="26c20107047db9e3911118efbf083135"/><file name="Ping.php" hash="0eba99b10b71c666cecd95ddaef69df3"/><file name="Product.php" hash="60e3b6bcb43884af7e4a4ed48c3e3411"/><file name="Session.php" hash="798245d7d20c523b3c386c8bf25979d2"/></dir><dir name="Model"><dir name="Config"><dir name="Source"><file name="Productmode.php" hash="3b37b999e8d49fc23af6229bcae86bb9"/></dir></dir><dir name="Observer"><file name="Cart.php" hash="223544b7fc3717eeaebcadefb7f1344f"/><file name="Customer.php" hash="3e36530a774e2f9af9adbbb581f52380"/><file name="Newsletter.php" hash="ae3f3c645bc6eca8c4e4f33ff1f5d7e3"/><file name="Order.php" hash="fdcbad1124492f520b9edb72e0d88463"/><file name="Product.php" hash="e988fbf3dcf5ef6ea898b2668f2c4f55"/></dir><file name=".DS_Store" hash="194577a7e20bdcc7afbb718f502c134c"/></dir><dir name="Test"><dir name="Config"><file name="Base.php" hash="997583679f0981fbd2f0560cf40855d1"/></dir><dir name="Model"><dir name="Observer"><file name="Order.php" hash="d4655e7789a87b3fe8093355e862bfc4"/><file name="Product.php" hash="b9d3920d0d489c39245f747f15187085"/></dir></dir></dir><dir name="controllers"><file name="WizardController.php" hash="558e829a66e2ad9a7b7c1ad9d7d4a530"/></dir><dir name="etc"><file name="config.xml" hash="215ec9ebcca47551da78e741cd6ca029"/><file name="system.xml" hash="f494e9ed2da1f2554196847753629cb4"/></dir><file name=".DS_Store" hash="d8b910e9c4677fce43c430c2bb123061"/></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="ometria"><file name="core.xml" hash="d8d696fec5b40262b9307a0bb89bcede"/></dir></dir><dir name="template"><dir name="ometria"><file name="head.phtml" hash="1ef17e826431c85e14532d7660b38ee8"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="ometria"><file name="core.xml" hash="4fd702d8159187002eebb40c9b3ebe1b"/></dir></dir><dir name="template"><dir name="ometria"><dir name="system"><dir name="config"><file name="start_wizard.phtml" hash="d4a4e6d6ab16048f1e436793cb24a668"/></dir></dir><dir name="wizard"><file name="finished.phtml" hash="e475e0a7fb28b2b054a1b26cae5fd9b8"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ometria_Core.xml" hash="f8ec0ef46b669bf0070d9064300fc0fd"/><file name="Ometria_Api.xml" hash="e9309a378992b51f710a9fca17a3055e"/><file name="Ometria_AbandonedCarts.xml" hash="a69a03804840e784362410c2596c0a08"/></dir></target><target name="mageweb"><dir name="js"><dir name="ometria"><file name="checkout.js" hash="78b5fed53276d65a42c5cad4bf92a35f"/></dir></dir></target></contents>
31
  <compatible/>
32
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
33
  </package>