Skip to content

Instantly share code, notes, and snippets.

@mattclements
Last active December 30, 2015 17:49
Show Gist options
  • Save mattclements/7863196 to your computer and use it in GitHub Desktop.
Save mattclements/7863196 to your computer and use it in GitHub Desktop.
Magento - Setup Product URL's after Import
<?php
require 'app/Mage.php';
Mage::app();
$amount = 0;
$model = Mage::getModel('catalog/product');
$products = $model->getCollection();
foreach ($products as $product) {
$model->load($product->getId());
$product->setUrlKey($model->getName())->save();
set_time_limit();
$amount++;
}
INSERT IGNORE INTO cataloginventory_stock_status (product_id, website_id, stock_id, qty, stock_status)
SELECT entity_id as product_id, 1 as website_id, 1 as stock_id, 10000.0000 as qty, 1 as stock_status
FROM catalog_product_entity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment