Author Topic: Error with manufacturer.php  (Read 8825 times)

Offline digitalt

  • Full Member
  • ***
  • Posts: 116
  • Karma: +20/-0
    • View Profile
Error with manufacturer.php
« on: September 23, 2016, 11:59:02 AM »
This is showing up in error log:

2016-09-23 11:28:41 - warning: AbanteCart core v.1.2.8 Illegal string offset 'start' in <b>/home/digitalt2016/public_html/cbto.us/storefront/model/catalog/manufacturer.php</b> on line <b>66</b>

Also on line 80.

Did some research and it appears that a string is being called as an array. Not a big deal from what I have read, but it could slow down overall performance.  For newbie ecommerce sites, response is of the utmost importance. Ya'all got a simple fix?

Here's the code for that section:
Code: [Select]
$cache_key = 'manufacturer.list.'.md5((int)$data['start'].(int)$data['limit']).'.store_'.$store_id;
$output = $this->cache->pull( $cache_key );

if ($output !== false){
return $output;
}

$sql = "SELECT *
FROM " . $this->db->table("manufacturers") . " m
LEFT JOIN " . $this->db->table("manufacturers_to_stores") . " m2s
ON (m.manufacturer_id = m2s.manufacturer_id)
WHERE m2s.store_id = '" . $store_id . "'
ORDER BY sort_order, LCASE(m.name) ASC";

if ($data['limit']){
$sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
}
$query = $this->db->query($sql);
$output = $query->rows;
$this->cache->push($cache_key, $output);
return $output;
}

Appears to be the $cache_key string.

Offline Basara

  • Administrator
  • Hero Member
  • *****
  • Posts: 5774
  • Karma: +274/-2
    • View Profile
Re: Error with manufacturer.php
« Reply #1 on: September 26, 2016, 03:00:43 AM »
Hello.

What page you visit when error occur?

Offline digitalt

  • Full Member
  • ***
  • Posts: 116
  • Karma: +20/-0
    • View Profile
Re: Error with manufacturer.php
« Reply #2 on: September 26, 2016, 05:47:35 AM »
I'm not sure. It seems intermittent.  This is only in A-cart error log and not the server error log.

If I remember correctly, this started showing up after I cloned the default theme into an extension. The only mods I did to the theme were in the style.css and custom.js.

Let me do some checking and I'll get back to you. There were a lot of errors yesterday and I was working on shipping methods. Maybe connected to that?  I'll see if I can recreate the error to a specific page or package.

Offline eCommerce Core

  • Administrator
  • Hero Member
  • *****
  • Posts: 1602
  • Karma: +93/-1
    • View Profile
Re: Error with manufacturer.php
« Reply #3 on: September 26, 2016, 08:46:30 AM »
“If you’re in the luckiest one per cent of humanity, you owe it to the rest of humanity to think about the other 99 per cent.”
― Warren Buffett

Offline digitalt

  • Full Member
  • ***
  • Posts: 116
  • Karma: +20/-0
    • View Profile
Re: Error with manufacturer.php
« Reply #4 on: September 26, 2016, 12:40:30 PM »
That's what's there. Oops, using 1.2.8.

It doesn't cause any real performance issues on Godaddy for me. But wanted to make you aware of it.


Took a closer look today and applied the new code. So far so good.
« Last Edit: September 27, 2016, 12:15:26 PM by digitalt »

Offline digitalt

  • Full Member
  • ***
  • Posts: 116
  • Karma: +20/-0
    • View Profile
Re: Error with manufacturer.php
« Reply #5 on: September 27, 2016, 05:06:44 PM »
So far the mod works great.

Thanks

Offline digitalt

  • Full Member
  • ***
  • Posts: 116
  • Karma: +20/-0
    • View Profile
Re: Error with manufacturer.php
« Reply #6 on: October 23, 2016, 10:02:22 AM »
I've been ignoring this, but also have been getting this error:

2016-10-23 6:43:11 - warning: AbanteCart core v.1.2.8 Illegal string offset 'limit' in <b>/home/digitalt2016/public_html/cbto.us/storefront/model/catalog/manufacturer.php</b> on line <b>83</b>

This is the code starting at line 83:
Code: [Select]
if ($data['limit']){
$sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
}
$query = $this->db->query($sql);
$output = $query->rows;
$this->cache->push($cache_key, $output);
return $output;
}

I'm guessing the fix is similar to what was already done, but not sure how to do it.

Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 4358
  • Karma: +298/-10
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: Error with manufacturer.php
« Reply #7 on: October 23, 2016, 01:37:19 PM »
I wonder how this happen. Do you have some custom code/extension that calls getManufacturers method with limit passed?

Limit parameter is forced to 0 if negative and converted to int.
Please  rate your experience or leave your review
We need your help to build better free open source ecommerce platform for everyone. See how you can help

Offline digitalt

  • Full Member
  • ***
  • Posts: 116
  • Karma: +20/-0
    • View Profile
Re: Error with manufacturer.php
« Reply #8 on: October 24, 2016, 07:46:08 AM »
The only extension I added was Whitelabel and cloned the default template as a new extension. The cloned template only has changes in the .css files and custom.js(no code modifications, only removed some things for a cleaner mobile screen).  Other than that it's a clean installation.

Strange thing is, the error seems random.  If it was serious, there should be an error every time manufacturer.php is called.

I just spent 15 minutes trying to recreate the error to pinpoint it and no luck.  Is there some code I could add to manufacturer.php to log more detail about this?  It's not creating a problem with the site, just a little annoying.

Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 4358
  • Karma: +298/-10
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: Error with manufacturer.php
« Reply #9 on: November 09, 2016, 09:17:36 AM »
Check your Apache log. It it possible that someone is paying with pagination parameters and that will cause this error.
It will not destroy anything. Possibly we can add better error handling in here. 
Please  rate your experience or leave your review
We need your help to build better free open source ecommerce platform for everyone. See how you can help

Offline digitalt

  • Full Member
  • ***
  • Posts: 116
  • Karma: +20/-0
    • View Profile
Re: Error with manufacturer.php
« Reply #10 on: November 09, 2016, 01:48:54 PM »
Thanks, I'll check it.

Offline gadziraman

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
logo changing problem
« Reply #11 on: November 12, 2016, 03:18:19 PM »
hi i am having problem in putting store logo, if i click edit on default template comes blank fields without AbanteCart store logo and icon so there will be no where to click to change the logo , how do i correct the problem. 

Offline digitalt

  • Full Member
  • ***
  • Posts: 116
  • Karma: +20/-0
    • View Profile
Re: Error with manufacturer.php
« Reply #12 on: November 13, 2016, 11:59:15 AM »
Just a thought, but could this error be coming from the manufacturers data cache? I have had problems with errors that didn't resolve till I cleared the caches and then everything was okay.

Is there a way to disable manufacturers data cache to test ?

 

Powered by SMFPacks Social Login Mod