Showing posts with label Magento. Show all posts
Showing posts with label Magento. Show all posts

Wednesday, 17 June 2015

WooCommerce Or Magento - What to use and when?

Magento and WooCommerce are currently the top two frameworks in use for e-commerce websites over the web. Both are backed by strong open-source communities developing plugins for various functionalities a shopping site might need – Magento, through Magento Connect and Woocommerce, through being an all-out open-source themed marketplace. Owing to these and many other factors, it sometimes becomes overwhelming to tackle the question – “Which one to use for my shopping site?!”
To Read complete information about “Woocommerce Or Magento” visit FindNerd. Apart from this, you can also ask questions & look for various programming queries along with their solutions including Android, Php, C, java programming questions and answers etc.as it is an effective technology forum also.

Sunday, 3 May 2015

Delete Test Sales/Order data from Magento





To delete the test sales/Order data from magento run the below queries in your magento database --
  1. SET FOREIGN_KEY_CHECKS=0;
  2. ##############################
  3. # SALES RELATED TABLES
  4. ##############################
  5. TRUNCATE `sales_flat_creditmemo`;
  6. TRUNCATE `sales_flat_creditmemo_comment`;
  7. TRUNCATE `sales_flat_creditmemo_grid`;
  8. TRUNCATE `sales_flat_creditmemo_item`;
  9. TRUNCATE `sales_flat_invoice`;
  10. TRUNCATE `sales_flat_invoice_comment`;
  11. TRUNCATE `sales_flat_invoice_grid`;
  12. TRUNCATE `sales_flat_invoice_item`;
  13. TRUNCATE `sales_flat_order`;
  14. TRUNCATE `sales_flat_order_address`;
  15. TRUNCATE `sales_flat_order_grid`;
  16. TRUNCATE `sales_flat_order_item`;
  17. TRUNCATE `sales_flat_order_payment`;
  18. TRUNCATE `sales_flat_order_status_history`;
  19. TRUNCATE `sales_flat_quote`;
  20. TRUNCATE `sales_flat_quote_address`;
  21. TRUNCATE `sales_flat_quote_address_item`;
  22. TRUNCATE `sales_flat_quote_item`;
  23. TRUNCATE `sales_flat_quote_item_option`;
  24. TRUNCATE `sales_flat_quote_payment`;
  25. TRUNCATE `sales_flat_quote_shipping_rate`;
  26. TRUNCATE `sales_flat_shipment`;
  27. TRUNCATE `sales_flat_shipment_comment`;
  28. TRUNCATE `sales_flat_shipment_grid`;
  29. TRUNCATE `sales_flat_shipment_item`;
  30. TRUNCATE `sales_flat_shipment_track`;
  31. TRUNCATE `sales_invoiced_aggregated`; # ??
  32. TRUNCATE `sales_invoiced_aggregated_order`; # ??
  33. TRUNCATE `log_quote`;
  34. ALTER TABLE `sales_flat_creditmemo_comment` AUTO_INCREMENT=1;
  35. ALTER TABLE `sales_flat_creditmemo_grid` AUTO_INCREMENT=1;
  36. ALTER TABLE `sales_flat_creditmemo_item` AUTO_INCREMENT=1;
  37. ALTER TABLE `sales_flat_invoice` AUTO_INCREMENT=1;
  38. ALTER TABLE `sales_flat_invoice_comment` AUTO_INCREMENT=1;
  39. ALTER TABLE `sales_flat_invoice_grid` AUTO_INCREMENT=1;
  40. ALTER TABLE `sales_flat_invoice_item` AUTO_INCREMENT=1;
  41. ALTER TABLE `sales_flat_order` AUTO_INCREMENT=1;
  42. ALTER TABLE `sales_flat_order_address` AUTO_INCREMENT=1;
  43. ALTER TABLE `sales_flat_order_grid` AUTO_INCREMENT=1;
  44. ALTER TABLE `sales_flat_order_item` AUTO_INCREMENT=1;
  45. ALTER TABLE `sales_flat_order_payment` AUTO_INCREMENT=1;
  46. ALTER TABLE `sales_flat_order_status_history` AUTO_INCREMENT=1;
  47. ALTER TABLE `sales_flat_quote` AUTO_INCREMENT=1;
  48. ALTER TABLE `sales_flat_quote_address` AUTO_INCREMENT=1;
  49. ALTER TABLE `sales_flat_quote_address_item` AUTO_INCREMENT=1;
  50. ALTER TABLE `sales_flat_quote_item` AUTO_INCREMENT=1;
  51. ALTER TABLE `sales_flat_quote_item_option` AUTO_INCREMENT=1;
  52. ALTER TABLE `sales_flat_quote_payment` AUTO_INCREMENT=1;
  53. ALTER TABLE `sales_flat_quote_shipping_rate` AUTO_INCREMENT=1;
  54. ALTER TABLE `sales_flat_shipment` AUTO_INCREMENT=1;
  55. ALTER TABLE `sales_flat_shipment_comment` AUTO_INCREMENT=1;
  56. ALTER TABLE `sales_flat_shipment_grid` AUTO_INCREMENT=1;
  57. ALTER TABLE `sales_flat_shipment_item` AUTO_INCREMENT=1;
  58. ALTER TABLE `sales_flat_shipment_track` AUTO_INCREMENT=1;
  59. ALTER TABLE `sales_invoiced_aggregated` AUTO_INCREMENT=1;
  60. ALTER TABLE `sales_invoiced_aggregated_order` AUTO_INCREMENT=1;
  61. ALTER TABLE `log_quote` AUTO_INCREMENT=1;
  62. SET FOREIGN_KEY_CHECKS=1;
it will delete all test data and create new order with id '1' .
For such more Blogs you can visit to http://findnerd.com/NerdDigest

Thursday, 30 April 2015

Print query in magento

/----------Get products collection --------------/
  1. <p>$allproducts = Mage::getModel('catalog/product')-&gt;getCollection()-&gt;addAttributeToSort('name', 'ASC');;</p>
It will return you total products, sorted by name in ascending order from magento database. To print query write the below statement :-
  1. <p>echo $allproducts-&gt;getSelect();</p>

For such more Blogs you can visit to http://findnerd.com/NerdDigest


Monday, 27 April 2015

Why to prefer Magento over Zen cart

As eCommerce market in India is about to grow over $24 Billion USD by the end of 2015.To grab the opportunity of this growing market there are many eCommerce stores are coming up and each facilitating new features to make the user experience great. Which initiated a demand of eCommerce platforms between the developers which are more scalable for the development of the stores for their clients.
Magento is one such platform which has been enabling the developer to do provide all such features since its inception and giving a tough competition to its predecessors like Zen Cart .
Here are the list of inbuilt features that make you choose Magento over Zen Cart .
- Multi-store
- iPhone Optimized themes.
- Email Template
- On-click Install Module
- Product Comparison
- Bundled products
- Up sell Products
- Add to Wishlist
- Shipping to Multiple address
- Generating Multiple invoices .


For such more Blogs you can visit to http://findnerd.com/NerdDigest


Sunday, 26 April 2015

Programmatically create coupon codes in Magento

Create backup for your database and project directory 2.create a form to post the coupon code information. such as
  1. <div >
  2. <h2>Create New Coupons</h2>
  3. </div>
  4. <div >
  5. <div >
  6. <div >
  7. <dl >
  8. <dt><label for="discount">Discount Value Type</label></dt>
  9. <dd>
  10. <div >
  11. <select id="discount" name="discountType">
  12. <option value="by_percent">Percent</option>
  13. <option value="by_fixed">Fixed</option>
  14. </select></div>
  15. <div >
  16. <label for="value">value</label>
  17. <input id="spinner" name="discount_amount" value="">
  18. </div>
  19. <div ></div>
  20. </dd>
  21. <dt><label for="start_date">Start Date <a href="javascript:void(0)">?</a></label></dt>
  22. <dd>
  23. <div ><input id="datepicker" name="start_date" value=""></div>
  24. <!--input id="start_date" name="start_date" value=""></div-->
  25. <div >
  26. <label for="expire_date">Expiration Date</label>
  27. <input id="datepickerend" name="expire_date" value=" ">
  28. <!--input id="expire_date" name="expire_date" value=""-->
  29. </div>
  30. <div ></div>
  31. </dd>
  32. <dt><label for="coupon_code">Coupon Code <a href="javascript:void(0)">?</a></label></dt>
  33. <dd>
  34. <div >
  35. <input id="coupon_code" name="coupon_code" value=" "></div>
  36. <div ></div>
  37. </dd>
  38. <dt><label for="coupon_detail">Coupon Description <a href="javascript:void(0)">?</a></label></dt>
  39. <dd>
  40. <div ><textarea id="coupon_detail" name="coupon_detail"></textarea></div>
  41. <div ></div>
  42. </dd>
  43. </dl>
  44. </div>
  45. </div>
  46. <p><label for="discount_assign"> The Discount will be assigned on <a href="javascript:void(0)">?</a></label> &nbsp; <select id="discount_assign" name="discount_assign">
  47. <option value="0">Order Dishes Sum</option>
  48. <option value="1">Order Total Sum</option>
  49. </select></p>Coupon Limitations <a href="javascript:void(0)">?</a><p></p>
  50. <div >
  51. <ul >
  52. <li ># Times
  53. <div ><input name="times" value=" " id="spinner1"></div>
  54. </li>
  55. <li> # Times Per User
  56. <div ><input name="perUser" value=" " id="spinner2" "=""></div>
  57. </li>
  58. </ul>
  59. </div>
  60. </div>

3:create Action for post the form data such as
  1. <p><!--?php public function saveCouponAction(){</p-->
  2. </p><pre>$param=$this-&gt;getRequest()-&gt;getPost();
  3. $conditions_serialized = 'a:7:{s:4:"type";s:32:"salesrule/rule_condition_combine";s:9:"attribute";N;s:8:"operator";N;s:5:"value";s:1:"1";s:18:"is_value_processed";N;s:10:"aggregator";s:3:"all";s:10:"conditions";a:1:{i:0;a:5:{s:4:"type";s:32:"salesrule/rule_condition_address";s:9:"attribute";s:13:"base_subtotal";s:8:"operator";s:2:"==";s:5:"value";s:2:"12";s:18:"is_value_processed";b:0;}}}';
  4. $data = unserialize($conditions_serialized);
  5. $data['conditions'][0]['value'] = $param['cart_value'];
  6. (string)$conditions_serialized = serialize($data);
  7. (string)$actions_serialized = 'a:6:{s:4:\"type\";s:40:\"salesrule/rule_condition_product_combine\";s:9:\"attribute\";N;s:8:\"operator\";N;s:5:\"value\";s:1:\"1\";s:18:\"is_value_processed\";N;s:10:\"aggregator\";s:3:\"all\";}';
  8. $data = array(
  9. 'product_ids' =&gt; null,
  10. 'name' =&gt;$param['coupon_code'],
  11. 'description' =&gt;$param['coupon_detail'],
  12. 'is_active' =&gt; 1,
  13. 'website_ids' =&gt; array(1),
  14. 'customer_group_ids' =&gt; array(1),
  15. 'coupon_type' =&gt; 2,
  16. 'coupon_code' =&gt;$param['coupon_code'],
  17. 'uses_per_coupon' =&gt;$param['times'],
  18. 'uses_per_customer' =&gt;$param['perUser'],
  19. 'from_date' =&gt;$param['start_date'],
  20. 'to_date' =&gt;$param['expire_date'],
  21. 'sort_order' =&gt; null,
  22. 'is_rss' =&gt; 1,
  23. 'conditions_serialized' =&gt; "'$conditions_serialized'",
  24. 'actions_serialized' =&gt; "'$actions_serialized'",
  25. 'simple_action' =&gt;$param['discountType'],
  26. 'discount_amount' =&gt;$param['discount_amount'],
  27. 'discount_qty' =&gt; 0,
  28. 'discount_step' =&gt; null,
  29. 'apply_to_shipping' =&gt; $param['discount_assign'],
  30. 'simple_free_shipping' =&gt; 0,
  31. 'stop_rules_processing' =&gt; 0,
  32. 'store_labels' =&gt; array($param['coupon_detail'])
  33. </pre>
  34. <p>);
  35. /<em>echo "</em></p><pre><em>";
  36. print_r($data);
  37. die();</em>/
  38. try{
  39. $model = Mage::getModel('salesrule/rule');
  40. $data = $this-&gt;<em>filterDates($data, array('from</em>date', 'to<em>date'));
  41. $validateResult = $model-&gt;validateData(new Varien</em>Object($data));
  42. if ($validateResult == true) {
  43. if (isset($data['simple<em>action']) &amp;&amp; $data['simple</em>action'] == 'by<em>percent'
  44. &amp;&amp; isset($data['discount</em>amount'])) {
  45. $data['discount<em>amount'] = min(100, $data['discount</em>amount']);
  46. }
  47. if (isset($data['rule']['conditions'])) {
  48. $data['conditions'] = $data['rule']['conditions'];
  49. }
  50. if (isset($data['rule']['actions'])) {
  51. $data['actions'] = $data['rule']['actions'];
  52. }
  53. unset($data['rule']);
  54. $model-&gt;loadPost($data);
  55. $model-&gt;save();
  56. $this-&gt;_redirect('manager/account/coupons');
  57. }
  58. }
  59. catch (Exception $e){
  60. echo $e-&gt;getMessage();
  61. }
  62. }<p></p>

4: check from admin panel or database table salesrule coupon has been added to your magento store.



For such more Blogs you can visit to http://findnerd.com/NerdDigest