Hello,
I am facing a error
Parse error: syntax error, unexpected ‘[’, expecting ‘)’
Code
<!--Edit/Add By Kewal-->
<?
$total = Mage::getSingleton('checkout/cart')->getQuote()->getTotals();
$freegift = $total["subtotal"]->getValue();
?>
<!--Edit/Add By Kewal-->
<?php
if( $freegift > 100 and $_item->getProduct()->getId() != 1788 ){
$_product = Mage::getModel('catalog/product')->load([1788]);
?>
<script>
window.onload = setLocation('<?php echo (string)Mage::helper('checkout/cart')->getAddUrl($_product);?>')
</script>
<?
}
?>
<!--Edit/Add By Kewal-->
Thank you
What line number does the error message give for the error? Is it this one:
$_product = Mage::getModel('catalog/product')->load([1788]);
Why do you have the product id surrounded by square brackets? Only example code I can see for this in a quick google is just load(1788).
rpkamp
May 22, 2014, 11:29am
3
droopsnoot:
What line number does the error message give for the error? Is it this one:
$_product = Mage::getModel('catalog/product')->load([1788]);
Why do you have the product id surrounded by square brackets? Only example code I can see for this in a quick google is just load(1788).
I agree that’s probably the line. It seems the OP wants to use short array syntax introduced in PHP 5.4 ([…] instead of array(…)), but the host is running an older version of PHP and doesn’t understand the syntax. Better to change [1778] to array(1788), or ask your host if they are willing to update to PHP 5.4 (or 5.5, which is the current stable version)