How to translate an array of values from DB - laravel

I have an array of values that get from DB:
$repairs = DB::table('repair_parts')->orderBy('repair', 'asc')
->where('status_id', '1')->distinct()->lists('repair', 'id');
I want to ttranslate those values in another lang. To display in the view:
{{ Form::select('repair', $repairs, isset($v->repair_id) ? $v->repair_id : '', array(
'class' => 'form-control',
'id'=>'repair_field',
'placeholder' => Lang::get('messages.repair')))
}}
the problem is that I can't translate them with Lang::get('repair'.$repairs). Is there any other way to do it?
EDIT
array(13) { [22]=> string(2) "dd" [23]=> string(3) "fff" [21]=> string(4) "Test" [5]=> string(4) "test" [13]=> string(4) "test" [7]=> string(5) "test3" [14]=> string(5) "test4" [15]=> string(5) "test6" [16]=> string(5) "test6" [18]=> string(5) "test6" [19]=> string(5) "test6" [17]=> string(5) "test6" [20]=> string(5) "Tires" }

Solved. What I did was append to the values of the array
array_walk($repairs, function(&$value, $key) { $value = Lang::get('repair.'.$value); });
and I got translated values.

Related

Not able to display from controller to view in codeigniter

Hi I'm Trying to display results from controller to view in Codeigniter. I fetching the results from model to controller and then displaying the details to map and inside div.
I'm using biostall for displaying on map.It is working perfectly.Also i want to display inside div also which is not working. Here is my Code..
My Model Code..
function getRegaddress($citycheck,$lat,$lng,$itemid,$hotelid) {
$return =array();
// Here goes Query....
//$query = mysql_query($results);
if ($query->num_rows() >0) {
foreach ($query->result() as $row) {
array_push($return, $row);
}
// return $query->result();
}
return $return;
}
}
Here The Controller code
$data = $this->maps_model->getRegaddress($citycheck,$lat,$lng,$itemid,$hotelid);
$data['hotelname'] = $hotelname;
$config['center'] = $lat.",".$lng;
$this->load->library('googlemaps');
$this->googlemaps->initialize($config);
foreach ($data as $coordinate) {
// $data = array();
// $data['values']=$coordinate->hotelname;
$marker = array();
$marker['title'] = $coordinate->hotelname;
$marker['position'] = $coordinate->lat.','.$coordinate->lng;
$this->googlemaps->add_marker($marker);
}
$data = array();
$data['map'] = $this->googlemaps->create_map();
$this->load->view('templates/_header');
$this->load->view('content/temp-view', $data);
$this->load->view('templates/footer');
View Code
<?php echo $map['js']; ?>
<div class="col-lg-8">
<div class="media">
<h3 class="media-heading text-danger-theme"><?php echo $hotelname; ?></h3>
<?php echo $map['html']; ?>
</div>
</div>
</div>
</div>
</div>
In the result ... The map marker is showing the details from database. But When I display the delalername on the div it is showing an error like ...
Severity: Notice
Message: Trying to get property of non-object
Filename: controllers/mapcontrol.php
Line Number: 84
A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
Filename: controllers/mapcontrol.php
Line Number: 84
Why i'm getting this error? Anyone Knows Please Help ...
Here is the structure of output
array(3) { [0]=> object(stdClass)#23 (15) { ["hotelid"]=> string(1) "2" ["hoteltype"]=> string(1) "3" ["hotelname"]=> string(18) "Sreekrishna food" ["dealerloc"]=> string(27) "Bengaluru, Karnataka, India" ["lat"]=> string(18) "12.971598700000000" ["lng"]=> string(18) "77.594562699999980" ["dealercity"]=> string(9) "Bengaluru" ["dealeraddress"]=> string(27) "Bengaluru, Karnataka, India" ["type"]=> string(2) "ar" ["stype"]=> string(3) "ggs" ["email"]=> string(15) "local#gmail.com" ["mobile"]=> string(10) "9947485214" ["phone"]=> string(10) "9947485214" ["website"]=> string(0) "" ["distance"]=> string(22) "0.00005899369716644287" } [1]=> object(stdClass)#24 (15) { ["hotelid"]=> string(1) "3" ["hoteltype"]=> string(1) "3" ["hotelname"]=> string(15) "Aey food" ["dealerloc"]=> string(42) "Shivaji Nagar, Bengaluru, Karnataka, India" ["lat"]=> string(18) "12.985650300000000" ["lng"]=> string(18) "77.605692699999960" ["dealercity"]=> string(13) "Shivaji Nagar" ["dealeraddress"]=> string(42) "Shivaji Nagar, Bengaluru, Karnataka, India" ["type"]=> string(2) "ar" ["stype"]=> string(3) "ggs" ["email"]=> string(9) "std#ff.il" ["mobile"]=> string(10) "9947485214" ["phone"]=> string(10) "9947485214" ["website"]=> string(0) "" ["distance"]=> string(18) "1.2265085392649464" } [2]=> object(stdClass)#25 (15) { ["hotelid"]=> string(1) "1" ["hoteltype"]=> string(1) "3" ["hotelname"]=> string(17) "Super - foods" ["dealerloc"]=> string(47) "FM Cariappa Colony, Bengaluru, Karnataka, India" ["lat"]=> string(18) "12.977923000000000" ["lng"]=> string(18) "77.612083499999930" ["dealercity"]=> string(18) "FM Cariappa Colony" ["dealeraddress"]=> string(47) "FM Cariappa Colony, Bengaluru, Karnataka, India" ["type"]=> string(2) "ar" ["stype"]=> string(3) "ggs" ["email"]=> string(11) "ddd#gfgf.in" ["mobile"]=> string(10) "9947485214" ["phone"]=> string(10) "9947485214" ["website"]=> string(12) "www.music.in" ["distance"]=> string(18) "1.2580702750661623" } }

integrate symfony and ajax

I need to send data using ajax in Symfony2 action.
For this I use the following js code:
$.ajax({
type: "POST",
url: "{{ path('slch_create_slot',{ 'uuid': meeting.uuid })}}",
data: request,
cache: false,
success: function(){
alert(data);
location.href = "{{ path('slch_new_meeting_step2',{ 'uuid': meeting.uuid })}}";
}
});
Symfony2 side I use the following code:
if($request->isXmlHttpRequest()){
$json = $request->getContent();
$tableau = json_decode($json, true);
var_dump($tableau);
....
$response = new Response(json_encode(array('response' => 'ok')));
$response->headers->set('Content-Type', 'application/json');
return $response;
}
When retrieving the Symfony2 response I get the following results:
array(1) {
["slots"]=>
array(4) {
[0]=>
array(5) {
["hour"]=>
string(2) "14"
["minute"]=>
string(1) "0"
["day"]=>
string(2) "11"
["month"]=>
string(1) "1"
["year"]=>
string(4) "2015"
}
[1]=>
array(5) {
["hour"]=>
string(2) "14"
["minute"]=>
string(1) "0"
["day"]=>
string(2) "12"
["month"]=>
string(1) "1"
["year"]=>
string(4) "2015"
}
[2]=>
array(5) {
["hour"]=>
string(2) "14"
["minute"]=>
string(1) "0"
["day"]=>
string(2) "13"
["month"]=>
string(1) "1"
["year"]=>
string(4) "2015"
}
[3]=>
array(5) {
["hour"]=>
string(2) "14"
["minute"]=>
string(1) "0"
["day"]=>
string(2) "14"
["month"]=>
string(1) "1"
["year"]=>
string(4) "2015"
}
}
}
{"response":"ok"}
can you tell me why I have the request in the Symfony2 response ?
you're doing var_dump($tableau) which dumps the request. That's why you're receiving it. Get rid of that line and you won't receive it anymore. – acontell 1 hour ago

Cache not delivering?

I recently updated to magento 1.9 but found my categories very slow. I couldn't find the problem so guessed this had to do with magento 1.9 and decided to downgrade to magento 1.8. Everything was working fine then, but after a while magento became slower again. I had made some changes due to some other errors, as I slightly changed /etc/local.xml. Obviously, I undid it again, even though it should not have been the reason in the first place. Unfortunately, this didn't solve my problem.
My current local.xml:
<cache>
<backend>Cm_Cache_Backend_File</backend>
<prefix>SH24_</prefix>
</cache>
Cm Cache Backend is definitely working. Same results when using standard cache.
I turned on the profiler, and how files are delivered looks completely different on a different development page.
http://i.imgur.com/fnLRheX.png
(Slow Page)
This is how it looks like on another test development site:
http://i.imgur.com/5lwHxH2.png
(Fast Page)
Generating difference is 6 seconds.
As you can tell, in the slow site, everything is nested under layout/db_updates, but on the slow site, it's not.
The most time consuming call is
CONFIGURABLE:Mage_Catalog_Model_Product_Type_Configurable::getConfigurableAttributes
which is not called on the fast site. Instead it's just:
__EAV_LOAD_MODEL__
In var/cache files appear. Error Log doesn't log anything.
Does anyone know, how I could solve this?
Thank you very much!
EDIT:
What I have found so far.
/Mage/Core/Model/Layout/update.php
public function fetchDbLayoutUpdates($handle)
{
$_profilerKey = 'layout/db_update: '.$handle;
Varien_Profiler::start($_profilerKey);
Mage::log($_profilerKey, null, 'mylogfile.log');
$updateStr = $this->_getUpdateString($handle);
if (!$updateStr) {
return false;
}
$updateStr = '<update_xml>' . $updateStr . '</update_xml>';
$updateStr = str_replace($this->_subst['from'], $this->_subst['to'], $updateStr);
$updateXml = simplexml_load_string($updateStr, $this->getElementClass());
$this->fetchRecursiveUpdates($updateXml);
$this->addUpdate($updateXml->innerXml());
Varien_Profiler::stop($_profilerKey);
return true;
}
As expected is $updateStr empty and the call returns falls.
So I had a closer look on $this->_getUpdateString($handle):
return Mage::getResourceModel('core/layout')->fetchUpdatesByHandle($handle);
I found fetchUpdatesByHandle($handle); in /Mage/Core/Model/Resource/Layout.php:
public function fetchUpdatesByHandle($handle, $params = array())
{
$bind = array(
'store_id' => Mage::app()->getStore()->getId(),
'area' => Mage::getSingleton('core/design_package')->getArea(),
'package' => Mage::getSingleton('core/design_package')->getPackageName(),
'theme' => Mage::getSingleton('core/design_package')->getTheme('layout')
);
foreach ($params as $key => $value) {
if (isset($bind[$key])) {
$bind[$key] = $value;
}
}
$bind['layout_update_handle'] = $handle;
$result = '';
$readAdapter = $this->_getReadAdapter();
if ($readAdapter) {
$select = $readAdapter->select()
->from(array('layout_update' => $this->getMainTable()), array('xml'))
->join(array('link'=>$this->getTable('core/layout_link')),
'link.layout_update_id=layout_update.layout_update_id',
'')
->where('link.store_id IN (0, :store_id)')
->where('link.area = :area')
->where('link.package = :package')
->where('link.theme = :theme')
->where('layout_update.handle = :layout_update_handle')
->order('layout_update.sort_order ' . Varien_Db_Select::SQL_ASC);
$result = join('', $readAdapter->fetchCol($select, $bind));
}
return $result;
}
$result is expected an empty string.
$select looks like this:
2014-06-22T13:52:12+00:00 DEBUG (7): handle CATEGORY_56
query
object(Varien_Db_Select)#295 (4) {
["_bind":protected]=>
array(0) {
}
["_adapter":protected]=>
object(Magento_Db_Adapter_Pdo_Mysql)#80 (31) {
["_defaultStmtClass":protected]=>
string(29) "Varien_Db_Statement_Pdo_Mysql"
["_transactionLevel":protected]=>
int(0)
["_connectionFlagsSet":protected]=>
bool(true)
["_ddlCache":protected]=>
array(1) {
[1]=>
array(2) {
["catalog_product_flat_1"]=>
array(56) {
["entity_id"]=>
array(14) {
["SCHEMA_NAME"]=>
NULL
["TABLE_NAME"]=>
string(22) "catalog_product_flat_1"
["COLUMN_NAME"]=>
string(9) "entity_id"
["COLUMN_POSITION"]=>
int(1)
["DATA_TYPE"]=>
string(3) "int"
["DEFAULT"]=>
NULL
["NULLABLE"]=>
bool(false)
["LENGTH"]=>
NULL
["SCALE"]=>
NULL
["PRECISION"]=>
NULL
["UNSIGNED"]=>
bool(true)
["PRIMARY"]=>
bool(true)
["PRIMARY_POSITION"]=>
int(1)
["IDENTITY"]=>
bool(false)
}
["attribute_set_id"]=>
array(14) {
["SCHEMA_NAME"]=>
NULL
["TABLE_NAME"]=>
string(22) "catalog_product_flat_1"
["COLUMN_NAME"]=>
string(16) "attribute_set_id"
["COLUMN_POSITION"]=>
int(2)
["DATA_TYPE"]=>
string(8) "smallint"
["DEFAULT"]=>
string(1) "0"
["NULLABLE"]=>
bool(false)
["LENGTH"]=>
NULL
["SCALE"]=>
NULL
["PRECISION"]=>
NULL
["UNSIGNED"]=>
bool(true)
["PRIMARY"]=>
bool(false)
["PRIMARY_POSITION"]=>
NULL
["IDENTITY"]=>
bool(false)
}
["type_id"]=>
array(14) {
["SCHEMA_NAME"]=>
NULL
["TABLE_NAME"]=>
string(22) "catalog_product_flat_1"
["COLUMN_NAME"]=>
string(7) "type_id"
["COLUMN_POSITION"]=>
int(3)
["DATA_TYPE"]=>
string(7) "varchar"
["DEFAULT"]=>
string(6) "simple"
["NULLABLE"]=>
bool(false)
["LENGTH"]=>
string(2) "32"
["SCALE"]=>
NULL
["PRECISION"]=>
NULL
["UNSIGNED"]=>
NULL
["PRIMARY"]=>
bool(false)
["PRIMARY_POSITION"]=>
NULL
["IDENTITY"]=>
bool(false)
}
["cost"]=>
array(14) {
["SCHEMA_NAME"]=>
NULL
["TABLE_NAME"]=>
string(22) "catalog_product_flat_1"
["COLUMN_NAME"]=>
string(4) "cost"
["COLUMN_POSITION"]=>
int(4)
["DATA_TYPE"]=>
string(7) "decimal"
["DEFAULT"]=>
NULL
["NULLABLE"]=>
bool(true)
["LENGTH"]=>
NULL
["SCALE"]=>
string(1) "4"
["PRECISION"]=>
string(2) "12"
["UNSIGNED"]=>
NULL
["PRIMARY"]=>
bool(false)
["PRIMARY_POSITION"]=>
NULL
["IDENTITY"]=>
bool(false)
}
["created_at"]=>
array(14) {
["SCHEMA_NAME"]=>
NULL
["TABLE_NAME"]=>
string(22) "catalog_product_flat_1"
["COLUMN_NAME"]=>
string(10) "created_at"
["COLUMN_POSITION"]=>
int(5)
["DATA_TYPE"]=>
string(9) "timestamp"
["DEFAULT"]=>
NULL
["NULLABLE"]=>
bool(true)
["LENGTH"]=>
NULL
["SCALE"]=>
NULL
["PRECISION"]=>
NULL
["UNSIGNED"]=>
NULL
["PRIMARY"]=>
bool(false)
["PRIMARY_POSITION"]=>
NULL
["IDENTITY"]=>
bool(false)
}
[MORE ATTRIBUTES]
}
}
}
["_bindParams":protected]=>
array(0) {
}
["_bindIncrement":protected]=>
int(0)
["_debug":protected]=>
bool(false)
["_logQueryTime":protected]=>
float(0.05)
["_logAllQueries":protected]=>
bool(false)
["_logCallStack":protected]=>
bool(false)
["_debugFile":protected]=>
string(23) "var/debug/pdo_mysql.log"
["_debugIoAdapter":protected]=>
NULL
["_debugTimer":protected]=>
int(0)
["_cacheAdapter":protected]=>
object(Varien_Cache_Core)#18 (6) {
["_specificOptions":protected]=>
array(1) {
["slab_size"]=>
int(0)
}
["_backend":protected]=>
object(Cm_Cache_Backend_File)#10 (4) {
["_options":protected]=>
array(11) {
["cache_dir"]=>
string(41) "/home/www/xxxx/magento/var/cache/"
["file_name_prefix"]=>
string(2) "cm"
["file_locking"]=>
bool(true)
["read_control"]=>
bool(false)
["read_control_type"]=>
string(5) "crc32"
["hashed_directory_level"]=>
int(2)
["use_chmod"]=>
bool(false)
["directory_mode"]=>
int(504)
["file_mode"]=>
int(432)
["hashed_directory_umask"]=>
int(504)
["cache_file_umask"]=>
int(432)
}
["_isTagDirChecked":protected]=>
NULL
["_metadatasArray":protected]=>
array(0) {
}
["_directives":protected]=>
array(3) {
["lifetime"]=>
int(7200)
["logging"]=>
bool(false)
["logger"]=>
NULL
}
}
["_options":protected]=>
array(9) {
["write_control"]=>
bool(true)
["caching"]=>
bool(true)
["cache_id_prefix"]=>
string(5) "xxx"
["automatic_serialization"]=>
bool(false)
["automatic_cleaning_factor"]=>
int(0)
["lifetime"]=>
int(7200)
["logging"]=>
bool(false)
["logger"]=>
NULL
["ignore_user_abort"]=>
bool(false)
}
["_lastId":"Zend_Cache_Core":private]=>
string(37) "XX_DB_PDO_MYSQL_DDL_eav_attribute_1"
["_extendedBackend":protected]=>
bool(true)
["_backendCapabilities":protected]=>
array(6) {
["automatic_cleaning"]=>
bool(true)
["tags"]=>
bool(true)
["expired_read"]=>
bool(true)
["priority"]=>
bool(false)
["infinite_lifetime"]=>
bool(true)
["get_list"]=>
bool(true)
}
}
["_isDdlCacheAllowed":protected]=>
bool(true)
["_ddlColumnTypes":protected]=>
array(13) {
["boolean"]=>
string(4) "bool"
["smallint"]=>
string(8) "smallint"
["integer"]=>
string(3) "int"
["bigint"]=>
string(6) "bigint"
["float"]=>
string(5) "float"
["decimal"]=>
string(7) "decimal"
["numeric"]=>
string(7) "decimal"
["date"]=>
string(4) "date"
["timestamp"]=>
string(9) "timestamp"
["datetime"]=>
string(8) "datetime"
["text"]=>
string(4) "text"
["blob"]=>
string(4) "blob"
["varbinary"]=>
string(4) "blob"
}
["_ddlRoutines":protected]=>
array(5) {
[0]=>
string(3) "alt"
[1]=>
string(3) "cre"
[2]=>
string(3) "ren"
[3]=>
string(3) "dro"
[4]=>
string(3) "tru"
}
["_tempRoutines":protected]=>
string(22) "#^\w+\s+temporary\s#im"
["_intervalUnits":protected]=>
array(6) {
["YEARS"]=>
string(4) "YEAR"
["MONTHS"]=>
string(5) "MONTH"
["DAYS"]=>
string(3) "DAY"
["HOURS"]=>
string(4) "HOUR"
["MINUTES"]=>
string(6) "MINUTE"
["SECOND"]=>
string(6) "SECOND"
}
["_queryHook":protected]=>
array(2) {
["object"]=>
object(Mage_Core_Model_Resource_Setup)#77 (9) {
["_resourceName":protected]=>
string(14) "livechat_setup"
["_resourceConfig":protected]=>
object(Mage_Core_Model_Config_Element)#124 (2) {
["setup"]=>
object(Mage_Core_Model_Config_Element)#401 (1) {
["module"]=>
string(14) "Zopim_Livechat"
}
["connection"]=>
object(Mage_Core_Model_Config_Element)#580 (1) {
["use"]=>
string(10) "core_setup"
}
}
["_connectionConfig":protected]=>
object(Mage_Core_Model_Config_Element)#35 (9) {
["host"]=>
string
["username"]=>
string
["password"]=>
string
["dbname"]=>
string(13)
["initStatements"]=>
string(14) "SET NAMES utf8"
["model"]=>
string(6) "mysql4"
["type"]=>
string(9) "pdo_mysql"
["pdoType"]=>
object(Mage_Core_Model_Config_Element)#580 (0) {
}
["active"]=>
string(1) "1"
}
["_moduleConfig":protected]=>
object(Mage_Core_Model_Config_Element)#70 (3) {
["active"]=>
string(4) "true"
["codePool"]=>
string(5) "local"
["version"]=>
string(5) "0.5.0"
}
["_callAfterApplyAllUpdates":protected]=>
bool(false)
["_conn":protected]=>
*RECURSION*
["_tables":protected]=>
array(0) {
}
["_setupCache":protected]=>
array(0) {
}
["_queriesHooked":protected]=>
bool(true)
}
["method"]=>
string(17) "callbackQueryHook"
}
["_pdoType":protected]=>
string(5) "mysql"
["_numericDataTypes":protected]=>
array(16) {
[0]=>
int(0)
[1]=>
int(1)
[2]=>
int(2)
["INT"]=>
int(0)
["INTEGER"]=>
int(0)
["MEDIUMINT"]=>
int(0)
["SMALLINT"]=>
int(0)
["TINYINT"]=>
int(0)
["BIGINT"]=>
int(1)
["SERIAL"]=>
int(1)
["DEC"]=>
int(2)
["DECIMAL"]=>
int(2)
["DOUBLE"]=>
int(2)
["DOUBLE PRECISION"]=>
int(2)
["FIXED"]=>
int(2)
["FLOAT"]=>
int(2)
}
["_config":protected]=>
array(13) {
["host"]=>
string
["username"]=>
string
["password"]=>
string
["dbname"]=>
string
["initStatements"]=>
string(14) "SET NAMES utf8"
["model"]=>
string(6) "mysql4"
["type"]=>
string(9) "pdo_mysql"
["pdoType"]=>
string(0) ""
["active"]=>
string(1) "1"
["charset"]=>
NULL
["persistent"]=>
bool(false)
["options"]=>
array(3) {
["caseFolding"]=>
int(0)
["autoQuoteIdentifiers"]=>
bool(true)
["fetchMode"]=>
int(2)
}
["driver_options"]=>
array(0) {
}
}
["_fetchMode":protected]=>
int(2)
["_profiler":protected]=>
object(Zend_Db_Profiler)#52 (4) {
["_queryProfiles":protected]=>
array(0) {
}
["_enabled":protected]=>
bool(false)
["_filterElapsedSecs":protected]=>
NULL
["_filterTypes":protected]=>
NULL
}
["_defaultProfilerClass":protected]=>
string(16) "Zend_Db_Profiler"
["_connection":protected]=>
object(PDO)#94 (0) {
}
["_caseFolding":protected]=>
int(0)
["_autoQuoteIdentifiers":protected]=>
bool(true)
["_allowSerialization":protected]=>
bool(true)
["_autoReconnectOnUnserialize":protected]=>
bool(false)
}
["_parts":protected]=>
array(12) {
["straightjoin"]=>
bool(false)
["distinct"]=>
bool(false)
["columns"]=>
array(1) {
[0]=>
array(3) {
[0]=>
string(13) "layout_update"
[1]=>
string(3) "xml"
[2]=>
NULL
}
}
["union"]=>
array(0) {
}
["from"]=>
array(2) {
["layout_update"]=>
array(4) {
["joinType"]=>
string(4) "from"
["schema"]=>
NULL
["tableName"]=>
string(18) "core_layout_update"
["joinCondition"]=>
NULL
}
["link"]=>
array(4) {
["joinType"]=>
string(10) "inner join"
["schema"]=>
NULL
["tableName"]=>
string(16) "core_layout_link"
["joinCondition"]=>
string(52) "link.layout_update_id=layout_update.layout_update_id"
}
}
["where"]=>
array(5) {
[0]=>
string(33) "(link.store_id IN (0, :store_id))"
[1]=>
string(23) "AND (link.area = :area)"
[2]=>
string(29) "AND (link.package = :package)"
[3]=>
string(25) "AND (link.theme = :theme)"
[4]=>
string(50) "AND (layout_update.handle = :layout_update_handle)"
}
["group"]=>
array(0) {
}
["having"]=>
array(0) {
}
["order"]=>
array(1) {
[0]=>
array(2) {
[0]=>
string(24) "layout_update.sort_order"
[1]=>
string(3) "ASC"
}
}
["limitcount"]=>
NULL
["limitoffset"]=>
NULL
["forupdate"]=>
bool(false)
}
["_tableCols":protected]=>
array(0) {
}
}
Result
string(0) ""
The weird thing is, that in my fast test development, $result is also empty?
Really don't know what this all means!
EDIT2:
I noticed this when looking at the instantiated models using Magneto Debug:
MODELS
Resource Name Model Class Times Instantiated
catalog/category_flat Mage_Catalog_Model_Category 32
cms/page Mage_Cms_Model_Page 18
cms/block Mage_Cms_Model_Block 5
catalog/attribute Mage_Catalog_Model_Resource_Eav_Attribute 2
eav/entity_type Mage_Eav_Model_Entity_Type 2
core/url_rewrite Mage_Core_Model_Url_Rewrite 2
index/process Mage_Index_Model_Process 2
core/flag Mage_Catalog_Model_Product_Flat_Flag 1
customer/group Mage_Customer_Model_Group 1
But: catalog/product Mage_Catalog_Model_Product 9 is not shwon, even though there are displayed products, and which is instantiated in the fast shop.

Login immediately after signup

This way I store user information to DB:
$user = new User;
$user->email = $arr['email'];
$user->nick = $arr['display'];
$user->ip = Request::getClientIp();
$user->save();
and it does its work nicely but after save() method I'm going to log in the user this way:
Auth::login($user);
It never result in a true condition. Then I tried to log the user with his ID, when I dump the $user:
object(User)#179 (20) {
["connection":protected]=>
NULL
["table":protected]=>
NULL
["primaryKey":protected]=>
string(2) "id"
["perPage":protected]=>
int(15)
["incrementing"]=>
bool(true)
["timestamps"]=>
bool(true)
["attributes":protected]=>
array(6) {
["email"]=>
string(19) "myemail#gmail.com"
["nick"]=>
string(17) "my_name"
["ip"]=>
string(9) "127.0.0.1"
["updated_at"]=>
string(19) "2014-01-25 09:48:07"
["created_at"]=>
string(19) "2014-01-25 09:48:07"
["id"]=>
int(13)
}
.
.
.
Then I tried this:
Auth::loginUsingId($user->original['id']);
Actually $user->original['id'] doesn return NULL!
Helps are appreciated!

Issue in printing a session array variable

I have an peculiar session array variable,I need to pick one element to display on the screen.I'm not sure how to do that in smarty.Please give me the syntax how to manipulate the element in smarty.Here is the array values. I need to select ["school_name"] from the set.Please help
array(6) {
["id"]=> string(32) "cb60942f64d2b7bae2076926ae430f1d"
["sa"]=> NULL ["start_cache_timer"]=> int(1377752940) ["user"]=>
array(17) {
["host_id"]=> string(1) "9"
["user_id"]=> string(2) "16"
["school_name"]=> string(10) "Joseph High School"
["code"]=> string(10) "2E4C5339F8"
["academic_id"]=> string(2) "21"
["title"]=> string(2) "Mr"
["first_name"]=> string(3) "Jon"
["last_name"]=> string(7) "Bachura"
["name"]=> string(11) "Jon Bachura"
["email"]=> string(12) "jon#yeks.org"
["role"]=> string(1) "1"
["times_login"]=> int(656)
["acc_status"]=> string(1) "3"
["user_status"]=> string(1) "3"
["admin_user_id"]=>
string(2) "16"
["life"]=>
array(2) {
["current"]=>
int(1377756843)
["start"]=>
int(1377756843)
}
["training"]=>
array(1) {
["start_time"]=>
float(1377752946.14)
}
}
["mrole"]=>
NULL
["extAjaxSession"]=>
int(3)
}
Use $smarty.session:
$smarty.session.user.school_name

Resources