Skip to content

Instantly share code, notes, and snippets.

View webdawe's full-sized avatar
🏢
I may be slow to respond.

Anil Paul webdawe

🏢
I may be slow to respond.
View GitHub Profile
@webdawe
webdawe / qap.json
Last active September 6, 2021 23:20
sample
[
{
"id": 1,
"number": 1,
"survey_id": 1,
"label": "How likely are you to recommend us to a friend or colleague?",
"identifier": "how-likely-are-you-to-recommend-us-to-a-friend-or-colleague",
"answer_options": {
"label": "",
"options": [
<?php
//Magento 2
\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory,
\Magento\Framework\Stdlib\DateTime\TimezoneInterface $timezone
$currentDate = $this->_timezone->date()->format('Y-m-d H:i:s');
$collection = $this->_productCollectionFactory->create();
$collection->addAttributeToFilter('expiry_date', array('or'=> array(
0 => array('date' => true, 'from' => $currentDate),
1 => array('null' => true))
<script src="<?php echo Mage::getBaseUrl('js')."calendar/calendar.js" ?>" type="text/javascript"></script>
<script src="<?php echo Mage::getBaseUrl('js')."calendar/calendar-setup.js" ?>" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="<?php echo Mage::getBaseUrl('js') ?>calendar/calendar-win2k-1.css"  />
<?php echo $this->getLayout()->createBlock('core/html_calendar')->setTemplate('page/js/calendar.phtml')->toHtml();?>
<label for="date_picker_id"><?php echo $this->__('Your Date 1') ?> </label>
<input type="text" name="shipping_pickup_at_store_date" class="datetime" value=""/>

#Magento 1 #config.xml

<controller_front_init_routers>
<observers>
<vender>
<class>Vender_Model_Controller_Router</class>
<method>initControllerRouters</method>
</vender>
<?php
require_once 'abstract.php';
class Mage_Shell_Load_Urls extends Mage_Shell_Abstract
{
private $_baseUrl;
private $_urls = array();
public function run()
{
$storeId = 1;
@webdawe
webdawe / Attribute.php
Last active October 25, 2016 05:21
Configuration Settings Source Model for Product Attribute Collection
<?php
/**
*
* @category Webdawe
* @package Webdawe_General
* @author Anil Paul
* @copyright Copyright (c) 2016 Anil Paul
* @license
*/
@webdawe
webdawe / coutrywise_report.sql
Last active December 29, 2022 14:15
Query for retrieving country wise sales report from Magento Database
SET @fromDate = DATE_SUB(NOW(), INTERVAL 1 YEAR);
SELECT country_id, count(*) as total_orders,SUM(s.grand_total)
FROM `sales_flat_order_address` a
INNER JOIN sales_flat_order s ON s.entity_id = a.parent_id
WHERE s.created_at >= @fromDate
AND a.address_type = 'shipping'
GROUP BY country_id
ORDER BY total_orders DESC
@webdawe
webdawe / statewise_sales_summary.sql
Last active October 17, 2016 23:11
Query for retrieving statewise sales summary from Magento Database
SET @countryId = 'US';
SET @storeId = 7;
SELECT a.region,SUM(s.grand_total) AS total,COUNT(*) AS no_of_orders FROM sales_flat_order s
INNER JOIN sales_flat_order_address a ON a.entity_id = s.shipping_address_id
WHERE s.created_at >= DATE_SUB(NOW(), INTERVAL 1 YEAR)
AND a.address_type = 'shipping'
AND s.store_id = @storeId
AND a.country_id = @countryId
GROUP BY a.region
ORDER BY total desc
@webdawe
webdawe / sale_price_report.sql
Created October 12, 2016 00:31
Magento Store wise Month wise Price wise Qty Sales Report for a given categrory ID
SET @entityTypeId := (SELECT entity_type_id FROM eav_entity_type WHERE entity_type_code = 'catalog_product');
SET @nameAttributeId := (select attribute_id FROM eav_attribute where attribute_code = 'name' and entity_type_id = @entityTypeId);
SET @categoryId =5;
select w.name as website,name.value as product_name,oi.product_id,DATE_FORMAT(oi.created_at, '%b %Y'), oi.price,SUM(oi.qty_ordered) FROM sales_flat_order_item oi
INNER JOIN catalog_product_entity_varchar name ON name.entity_id = oi.product_id AND name.store_id = 0 AND name.attribute_id = @nameAttributeId
INNER JOIN core_store s ON s.store_id = oi.store_id
INNER JOIN core_website w ON w.website_id = s.website_id
WHERE product_id in (SELECT product_id FROM catalog_category_product where category_id = @categoryId)
AND created_at > DATE_SUB(NOW(), INTERVAL 12 MONTH)
GROUP BY oi.product_id,oi.price,DATE_FORMAT(oi.created_at, '%b %Y'),oi.store_id
@webdawe
webdawe / listValues.bas
Created October 5, 2016 03:10
Excel Vba Script to Get Values from a Range for Comma Seperated Values
Public Function ListValues(CSVList As String, rg As Range, NumberColumn As Long)
Dim findlist() As String
Dim listData As Variant
'Dim rg As Range
Dim colVal As Integer
'Set rg = Sheet2.Range("A2:B243")
Dim NumEntries As Long
Dim i As Long
findlist = Split(CSVList, ",")