Skip to content

Instantly share code, notes, and snippets.

View itaymesh's full-sized avatar
🎯
Focusing

Itay Raz itaymesh

🎯
Focusing
View GitHub Profile
"validate-israeli-phone-number": [
function (value) {
return /^(?:(?:(?:\s|\.|-)?)|(0[23489]{1})|(0[57]{1}[0-9]))?([^0\D]{1}\d{2}(?:\s|\.|-)?\d{4})$/i.test(value)
},
$t('Please enter a phone number without hyphens and spaces')
]
<script>
require([
'jquery',
'jquery/ui',
'jquery/validate',
'mage/translate'
], function($){
$.validator.addMethod(
'validate-customer-id-number', function(value) {
var IDnum = String(value);
@itaymesh
itaymesh / sql_magento_product_w-o_images.sql
Created April 9, 2018 10:47
Find products w/o images + status and qty
SELECT p.sku, p.entity_id, i.value as status, s.qty as qty
from catalog_product_entity p
left join catalog_product_entity_int i on p.entity_id = i.entity_id and i.store_id = 0
left join cataloginventory_stock_item s on p.entity_id = s.product_id and s.store_id
where p.entity_id not in (SELECT entity_id FROM `catalog_product_entity_varchar` where attribute_id = 87)
and i.attribute_id = 97
ORDER BY `status` DESC
@itaymesh
itaymesh / sql_magento_duplicate_skus.sql
Last active April 9, 2018 10:40
Find duplicate SKUs on Magento
select p.entity_id, p.sku, v.value as name
from catalog_product_entity p
left join catalog_product_entity_varchar v on p.entity_id = v.entity_id and v.attribute_id = 73 and v.store_id = 0
where p.sku in (select p.sku from catalog_product_entity p group by sku having count(*) > 1) ORDER BY `p`.`sku` ASC
@itaymesh
itaymesh / magento1_truncate_logs.sql
Created August 28, 2017 15:03
Magento1 Truncate Logs
TRUNCATE dataflow_batch_export;
TRUNCATE dataflow_batch_import;
TRUNCATE log_customer;
TRUNCATE log_quote;
TRUNCATE log_summary;
TRUNCATE log_summary_type;
TRUNCATE log_url;
TRUNCATE log_url_info;
TRUNCATE log_visitor;
TRUNCATE log_visitor_info;
@itaymesh
itaymesh / magento1_truncate_customers.sql
Created August 28, 2017 15:00
Magento 1 - Truncate Customer Tables
SET FOREIGN_KEY_CHECKS=0;
-- reset customers
TRUNCATE customer_address_entity;
TRUNCATE customer_address_entity_datetime;
TRUNCATE customer_address_entity_decimal;
TRUNCATE customer_address_entity_int;
TRUNCATE customer_address_entity_text;
TRUNCATE customer_address_entity_varchar;
TRUNCATE customer_entity;
TRUNCATE customer_entity_datetime;
@itaymesh
itaymesh / magento1_truncate_orders.sql
Created August 28, 2017 14:58
Magento 1 - Reset Magento Orders
SET FOREIGN_KEY_CHECKS=0;
##############################
# SALES RELATED TABLES
##############################
TRUNCATE `sales_flat_creditmemo`;
TRUNCATE `sales_flat_creditmemo_comment`;
TRUNCATE `sales_flat_creditmemo_grid`;
TRUNCATE `sales_flat_creditmemo_item`;
TRUNCATE `sales_flat_invoice`;