Skip to content

Instantly share code, notes, and snippets.

@Joso
Joso / di.xml
Created February 19, 2021 14:58 — forked from harshvardhanmalpani/di.xml
Fixes batch size for Magento 2.2.4 and above. Put the file in app/code/[Vendor]/[Module]/etc/adminhtml/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Catalog\Model\Indexer\Category\Product\Action\Full">
<arguments>
<argument name="batchRowsCount" xsi:type="number">1000</argument>
</arguments>
</type>
<type name="Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\BatchSizeCalculator">
<arguments>
<argument name="batchRowsCount" xsi:type="array">
if( is_home() || is_archive() ) {
return sprintf( '<a href="%1$s" class="more-link">%2$s</a>',
esc_url( get_permalink( get_the_ID() ) ), esc_html__( 'Read More', 'styleblog-plus' )
);
} else {
return '';
}
@Joso
Joso / tinydump
Created October 9, 2016 11:10 — forked from ceckoslab/tinydump
Simple PHP script, that creates a dump of Magento DB with smaller footprint ... the script just excludes the data some of the log tables, but keep the the schema of these tables.
<?php
define('DS', DIRECTORY_SEPARATOR);
function _getExtractSchemaStatement($sqlFileName, $db)
{
$dumpSchema = 'mysqldump' . ' ';
$dumpSchema .= '--no-data' . ' ';
$dumpSchema .= '-u ' . $db['user'] . ' ';
$dumpSchema .= '-p' . $db['pass'] . ' ';
$dumpSchema .= '-h ' . $db['host'] . ' ';
@Joso
Joso / magento_url_rewrite.patch
Created May 10, 2016 11:14 — forked from edannenberg/magento_url_rewrite.patch
Fixes the catalog url rewrite indexer in Magento 1.7.x-1.9.x See https://github.com/magento/bugathon_march_2013/issues/265 for details.Update: DexterDee in the ticket above noted that the previous patch had some side effects. This updated patch still feels like duct tape but at least it seems to be free of the mentioned side effects. It also fix…
diff -rupN mage_org/app/code/core/Mage/Catalog/Model/Url.php src_shop/app/code/core/Mage/Catalog/Model/Url.php
--- mage_org/app/code/core/Mage/Catalog/Model/Url.php 2013-11-19 00:48:25.679009391 +0100
+++ src_shop/app/code/core/Mage/Catalog/Model/Url.php 2013-11-19 00:49:24.188005601 +0100
@@ -643,13 +643,24 @@ class Mage_Catalog_Model_Url
$this->_rewrite = $rewrite;
return $requestPath;
}
+
+ // avoid unnecessary creation of new url_keys for duplicate url keys
+ $noSuffixPath = substr($requestPath, 0, -(strlen($suffix)));