Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Import XML problem in version 1.7.02
 
albundy
Jr. Member
 
Total Posts:  5
Joined:  2008-05-03
 

hi,

i have a xml import script which works without any problem with version 1.5.02
I now testing it with version 1.7.02 but nothing seems to happen. The data in version 1.7.02 is not been updated. Anyone know what can be wrong?

thanks for the help
Marcel

<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>

<xsl:stylesheet version=\\\"1.0\\\" xmlns:xsl=\\\"http://www.w3.org/1999/XSL/Transform\\\"
    
xmlns:w=\\\"http://www.aca.nl/schema/Nav2WebStock\\\">

<
xsl:output method=\\\"xml\\\" version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" omit-xml-declaration=\\\"yes\\\"/>

<
xsl:variable name=\\\"newline\\\"><xsl:text>
</
xsl:text></xsl:variable>

<
xsl:template match=\\\"/\\\">
    <
xsl:processing-instruction name=\\\"php\\\">
set_time_limit (0);
ini_set(\\\'memory_limit\\\'\\\'256M\\\');

require_once 
\\\'defs.php\\\';
require_once 
\\\'/var/www/vhosts/emmenmode.nl/httpdocs/app/Mage.php\\\';
Mage::app(STORE);

$storeId Mage::app()->getStore()->getId();
    </
xsl:processing-instruction>
    <
xsl:apply-templates select=\\\"/w:RetailiumWebshop/w:StockInfos/w:StockInfo\\\"/>
</
xsl:template>

<
xsl:template match=\\\"w:StockInfo\\\">
    <
xsl:variable name=\\\"sku1\\\">
        <
xsl:value-of select=\\\"@ItemNo\\\"/>
    </
xsl:variable>
    <
xsl:variable name=\\\"sku2\\\">
        <
xsl:value-of select=\\\"@VariantCode\\\"/>
    </
xsl:variable>
    <
xsl:variable name=\\\"sku\\\">
        <
xsl:value-of select=\\\"$sku1\\\"/>-<xsl:value-of select=\\\"$sku2\\\"/>
    </
xsl:variable>
    <
xsl:variable name=\\\"qty\\\">
        <
xsl:value-of select=\\\"sum(/w:RetailiumWebshop/w:StockInfos/w:StockInfo[@ItemNo=$sku1 and @VariantCode=$sku2]/@QtyInStock)\\\"/>
    </
xsl:variable>
    <
xsl:processing-instruction name=\\\"php\\\">
if(
$product Mage::getModel(\\\'catalog/product\\\')->loadByAttribute(\\\'sku\\\',\\\'<xsl:value-of select=\\\"$sku\\\"/>\\\')) {
    $productId 
$product->getId();
    
$stockItem Mage::getModel(\\\'cataloginventory/stock_item\\\')->loadByProduct($productId);
    
//$stockItemId = $stockItem->getId();
    //$stock = array();

    
if (!$stockItem->getId()) {
        $stockItem
->setData(\\\'product_id\\\'$product->getId());
        
$stockItem->setData(\\\'stock_id\\\'1);
    
//} else {
    //    $stock = $stockItem->getData();
    
}
    $stockItem
->setData(\\\'sku\\\'\\\'<xsl:value-of select=\\\"$sku\\\"/>\\\');
    
$stockItem->setData(\\\'qty\\\', <xsl:value-of select=\\\"$qty\\\"/>);
        <
xsl:choose>
            <
xsl:when test=\\\"$qty=\\\'0\\\'\\\">
    
$stockItem->setData(\\\'is_in_stock\\\'0);
            </
xsl:when>
            <
xsl:otherwise>
    
$stockItem->setData(\\\'is_in_stock\\\'1);
            </
xsl:otherwise>
        </
xsl:choose>
    try 
{
        $stockItem
->save();
    
catch (Exception $e){
        
echo \\\"exception:$e\\\";
    
}
}
    
</xsl:processing-instruction>
</
xsl:template>
</
xsl:stylesheet>
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top