Menu Content


> Diskusní fóra, FAQs & placená podpora
Welcome, Guest
Username Password: Remember me

str_replace strange behavior
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: str_replace strange behavior

str_replace strange behavior 4 months, 2 weeks ago #79652

In my codebase I have a line of code, which is triggered through a cron

const SALE_ORDER_NR = '{{order}}';
$text = str_replace(self::SALE_ORDER_NR, $order, $text);
I am using Magento 1.9;

Here, $order is of type : Sales_Model_Order

$text is not having any substring as {{order}}, instead it is :

Refund of Rs.150.00 for your order 145004617 has been initiated. Refund may take upto 8-9 days to credit into your bank account.
So, the strange behavior is that when I try to run the above code in my local server it passes without any issue.

But when I am trying to run the lines of code via the cron in my Testing Server, I get the following errors :

Catchable fatal error: Object of class Dbaux_Sales_Model_Order could not be converted to string in /var/www/html/magento3/app/code/local/Artio/SMSNotifier/Model/Sms/Template.php on line 351
Since I am new to the world of magento, it would be really helpful if reason for above behavior can be cleared.

Why is the error being thrown when running the cron, and not when I directly call the observer method from another method.
  • Page:
  • 1
Přihlášení uživatele Prázdný