Magento 2: Catalog Rule Collection -> filter by store

I have the following block of code that gets all active catalog rules: $catalog_rule_collection = $objectManager ->create(‘\Magento\CatalogRule\Model\RuleFactory’) ->create() ->getCollection() ->addFieldToFilter(‘simple_action’, ‘by_percent’) ->addIsActiveFilter(1); ->addFieldToFilter(‘simple_action’, ‘by_percent’) filters results to catalog rules with a percentage discount. ->addIsActiveFilter(1) filters results to only activated catalog rules. This simply retrieves table data from the catalogrule table. The following SQL query would…

Magento 2 – Show Subcategories and Images on Category Template

I want to show subcategories and the images on the category page. If the user clicks on Apparel the page would show all the subcategories with the subcategory image. I placed this code in my theme in My/theme/Magento_Catalog/templates/category/products.phtml <?php $category = $block->getCurrentCategory(); $subcategories = $category->getChildrenCategories(); $_helper = $this->helper(‘Magento\Catalog\Helper\Output’); $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); ?> <?php if(count($subcategories) >…

Run M2 from subdirectory

Magento 2.2.6 Have the main directory / and subdirectories like /germany, /france/, /poland etc. each subdirectory has index.php file like: <?php /** * Application entry point * * Example – run a particular store or website: * ——————————————– * require __DIR__ . ‘/app/bootstrap.php’; * $params = $_SERVER; * $params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = ‘website2’; * $params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = ‘website’;…