Post by OKI » Thu Sep 19, 2013 3:05 pm

Hello..... After upgrading to 1.5.6 My site is having serious problems. I am getting the dreaded 1146 error *Table 'XXXX_ocart.product_profile' doesn't exist * Everything works fine until selecting any product, either in ADMIN or the Front end. I have searched the forums and discovered a few issues similar, but not exactly like my situation. I have been trying to resolve this for the better part of a week. I have decided to stop wasting time trying to fix this myself and risk doing more harm than good. I would like to go back to 1.5.5.1 which was working fine. The issue now, is that the detailed instructions are for UPGRADING, not going backwards. Is there any documentation, guidance, TO-DO, or DON'T-DO lists, etc, that need to be observed for this action? Thanks in advance for any assistance or guidance to put this OC-Train back on the rails.
Last edited by OKI on Thu Sep 19, 2013 6:52 pm, edited 1 time in total.

OKI
Newbie

Posts

Joined
Thu Mar 29, 2012 1:37 am

Post by MarketInSG » Thu Sep 19, 2013 3:49 pm

It is almost impossible to go back easily. If you did back up first, then yes, there's hope for you. Else, you are going to spend half the day trying to compare the database structures and changing them accordingly.

Your other alternative is to fix that error. Just add in the table that's missing. I think this would be much quicker than downgrading


User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore

Post by OKI » Thu Sep 19, 2013 6:08 pm

Thanks for responding MarketInSG
I agree 100% ! For a real opencart geek fixing the error would be a piece of cake. The trouble is I am just a geek apprentice with a lack of knowledge in this area. Three years ago I didn't even know what CSS was. I have come a long way, however I have absolutely no idea where, in my database, this elusive table is, or should be. My level of understanding is still Theory of Operation. I also know how an internal combustion engine works, but trust me, you wouldn't want me to try to fix your car. I have searched the forums, Google, stack overflow, etc, and even tried to figure it out myself by opening MySQL to at least discover where this table goes. I really don't understand what the error message is telling me. I can't find product_profile anywhere. I am lost to the point that I need help. I would love to install the missing piece to this puzzle. I absolutely love learning this stuff. Normally I would just keep my nose in the documentation until I solved it. Unfortunately I don't have the choice this time, because I am about to change Hosts and need this to function before I move. I have about two weeks to put this together again.
I just thought maybe I could go back to 1.5.5.1 and deal with an upgrade later. Guess that option is OUT. I am also 100% in agreement with using the backup. It is the first lesson I learned three years ago. RULE #1 - Backup before modifying files. However the backup was inadvertently deleted. By the time I realized I had deleted my backup the Host generated backup had been automatically replaced with a newer version. Back to square one---the missing table. This is admittedly my own fault. Guess I could blame it on being 60, but that's lame, so I will just accept that I was careless.


Notice: Error: Table 'XXXXX_ocart.product_profile' doesn't exist
Error No: 1146
SELECT `pd`.* FROM `product_profile` `pp` JOIN `profile_description` `pd` ON `pd`.`language_id` = 1 AND `pd`.`profile_id` = `pp`.`profile_id` JOIN `profile` `p` ON `p`.`profile_id` = `pd`.`profile_id` WHERE `product_id` = 103 AND `status` = 1 AND `customer_group_id` = 8 ORDER BY `sort_order` ASC in /home/xxxxx/public_html/system/database/mysql.php on line 50

OKI
Newbie

Posts

Joined
Thu Mar 29, 2012 1:37 am

Post by MarketInSG » Thu Sep 19, 2013 9:48 pm

Run the following query

Code: Select all

CREATE TABLE IF NOT EXISTS `oc_product_profile` (
  `product_id` int(11) NOT NULL,
  `profile_id` int(11) NOT NULL,
  `customer_group_id` int(11) NOT NULL,
  PRIMARY KEY (`product_id`,`profile_id`,`customer_group_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `oc_product_recurring`
--

CREATE TABLE IF NOT EXISTS `oc_product_recurring` (
  `product_id` int(11) NOT NULL,
  `store_id` int(11) NOT NULL,
  PRIMARY KEY (`product_id`,`store_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
it should give you the missing tables that were newly added to v1.5.6


User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore

Post by OKI » Fri Sep 20, 2013 3:37 pm

Thank you so much for taking the time to assist. I was a little lost at first because I had never run a query before. I searched google and found a video example with step by step instructions. After the query I had two new tables in my database. oc_product_profile and oc_product_recurring. Unfortunately the same error still exists. I believe we are close though. I am in no way an authority on this subject, my experience is in Aviation Electronics. But troubleshooting problems regardless of the field, requires analytical thought. Just looking at the contents of the table, I am seeing something that doesn't fit what I would call the logical pattern. I am out of my realm of knowledge here, so I may be completely off the track in my thinking.
The list of tables are alphabetically sorted. All of the entries in the list having to do with products, are formed like this... product_xxxxxx. The error code that I am getting follows this same pattern. product_profile. The two new tables begin with oc_ before the word product. They are the only entries in the list that begin this way. Do you see where I am going with this? Like I said, I am a fish out of water here, so I may be swimming in plain air with this idea.
Again sincere thanks for taking the time to assist.

OKI
Newbie

Posts

Joined
Thu Mar 29, 2012 1:37 am

Post by MarketInSG » Fri Sep 20, 2013 3:54 pm

Modify my query above to suit your table's prefix. Mine had the prefix oc_ at the front. Yours might not have. So you might want to remove it, then run the query


User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore

Post by OKI » Fri Sep 20, 2013 7:53 pm

DONE ! The original 1146 error has now been replaced by a 1052 error. Guess that is a step in the right direction. At least the tables exist now.

Notice: Error: Column 'product_id' in where clause is ambiguous
Error No: 1052
SELECT `pd`.* FROM `product_profile` `pp` JOIN `profile_description` `pd` ON `pd`.`language_id` = 1 AND `pd`.`profile_id` = `pp`.`profile_id` JOIN `profile` `p` ON `p`.`profile_id` = `pd`.`profile_id` WHERE `product_id` = 131 AND `status` = 1 AND `customer_group_id` = 8 ORDER BY `sort_order` ASC in /home/xxxxx/public_html/system/database/mysql.php on line 50

From what I have researched it is caused from more than one column with the same name. Adding a prefix is recommended. (whatever that means)???
Does a query exist to find duplicate names in columns, or do I have to go one by one through the entire database looking for them?

OKI
Newbie

Posts

Joined
Thu Mar 29, 2012 1:37 am

User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore

Post by OKI » Fri Sep 20, 2013 8:29 pm

I don't know. That is why I was asking if a query existed to identify the duplicate column names within the entire database. From what I was reading, it seems that the computer can't tell one from the other if they have the same name. I am in way over my head here. Sorry if I am not clear. The above mentioned error happens when you select a product exactly like it did before when it said the tables were missing. Now though,I think it is saying that the tables exist with duplicate named columns. Maybe that is not what it is saying at all. I just googled the error and this is what was mentioned. Maybe it is caused by something else.

the error says: Notice: Error: Column 'product_id' in where clause is ambiguous

OKI
Newbie

Posts

Joined
Thu Mar 29, 2012 1:37 am

Post by MarketInSG » Fri Sep 20, 2013 10:21 pm

I just need to know which file is it that is loading the query.

WHERE `product_id` = 131 needs to be specific


User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore

Post by OKI » Fri Sep 20, 2013 10:27 pm

ok I understand. Unfortunately 131 is a specific product. Each product has a unique number, and they all have the same error. ie, another product shows this;

Notice: Error: Column 'product_id' in where clause is ambiguous
Error No: 1052
SELECT `pd`.* FROM `product_profile` `pp` JOIN `profile_description` `pd` ON `pd`.`language_id` = 1 AND `pd`.`profile_id` = `pp`.`profile_id` JOIN `profile` `p` ON `p`.`profile_id` = `pd`.`profile_id` WHERE `product_id` = 56 AND `status` = 1 AND `customer_group_id` = 8 ORDER BY `sort_order` ASC in /home/produi5/public_html/system/database/mysql.php on line 50

This is also a two language site, so each product id in the database is listed twice . Once for English once for French
Last edited by OKI on Fri Sep 20, 2013 11:43 pm, edited 1 time in total.

OKI
Newbie

Posts

Joined
Thu Mar 29, 2012 1:37 am

Post by MarketInSG » Sat Sep 21, 2013 8:51 am

edit catalog/model/catalog/product.php find line 588

Code: Select all

return $this->db->query("SELECT `pd`.* FROM `" . DB_PREFIX . "product_profile` `pp` JOIN `" . DB_PREFIX . "profile_description` `pd` ON `pd`.`language_id` = " . (int) $this->config->get('config_language_id') . " AND `pd`.`profile_id` = `pp`.`profile_id` JOIN `" . DB_PREFIX . "profile` `p` ON `p`.`profile_id` = `pd`.`profile_id` WHERE `product_id` = " . (int) $product_id . " AND `status` = 1 AND `customer_group_id` = " . (int) $customer_group_id . " ORDER BY `sort_order` ASC")->rows;
and change to

Code: Select all

return $this->db->query("SELECT `pd`.* FROM `" . DB_PREFIX . "product_profile` `pp` JOIN `" . DB_PREFIX . "profile_description` `pd` ON `pd`.`language_id` = " . (int) $this->config->get('config_language_id') . " AND `pd`.`profile_id` = `pp`.`profile_id` JOIN `" . DB_PREFIX . "profile` `p` ON `p`.`profile_id` = `pd`.`profile_id` WHERE `pp.product_id` = " . (int) $product_id . " AND `status` = 1 AND `customer_group_id` = " . (int) $customer_group_id . " ORDER BY `sort_order` ASC")->rows;


User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore

Post by OKI » Sat Sep 21, 2013 7:19 pm

I changed the product.php file as suggested. Below is a before and after shot of the generated error messages.
I have also since found another error when accessing products from the "ADMIN" for editing. I thought the two issues could be related and possibly provide a clue for finding a solution.

Errors BEFORE and AFTER suggested code modification - product.php code line 588
Error from “Front End” - Clicking on any Product generated this error:

(BEFORE) MOD

Notice: Error: Column 'product_id' in where clause is ambiguous
Error No: 1052
SELECT `pd`.* FROM `product_profile` `pp` JOIN `profile_description` `pd` ON `pd`.`language_id` = 1 AND `pd`.`profile_id` = `pp`.`profile_id` JOIN `profile` `p` ON `p`.`profile_id` = `pd`.`profile_id` WHERE `product_id` = 100 AND `status` = 1 AND `customer_group_id` = 8 ORDER BY `sort_order` ASC in /home/produi5/public_html/system/database/mysql.php on line 50


(AFTER) MOD

Notice: Error: Unknown column 'pp.product_id' in 'where clause'
Error No: 1054
SELECT `pd`.* FROM `product_profile` `pp` JOIN `profile_description` `pd` ON `pd`.`language_id` = 1 AND `pd`.`profile_id` = `pp`.`profile_id` JOIN `profile` `p` ON `p`.`profile_id` = `pd`.`profile_id` WHERE `pp.product_id` = 100 AND `status` = 1 AND `customer_group_id` = 8 ORDER BY `sort_order` ASC in /home/produi5/public_html/system/database/mysql.php on line 50



Error from “Admin” - Admin Menu -Catalog-Products - Clicking "EDIT" from any Product generates this error:
(Both - BEFORE & AFTER the product.php MOD generated the same message)

Notice: Error: Unknown column 'p.sort_order' in 'field list'
Error No: 1054
SELECT `p`.`profile_id`, `p`.`sort_order`, `pd`.`name` FROM `profile` AS `p` JOIN `profile_description` AS `pd` ON `pd`.`profile_id` = `p`.`profile_id` AND `pd`.`language_id` = 1 ORDER BY p.sort_order ASC in /home/produi5/public_html/system/database/mysql.php on line 50


It appears to me, that after your code change, both errors were narrowed down to "1054" column issues.
I don't know if that helps or not.

OKI
Newbie

Posts

Joined
Thu Mar 29, 2012 1:37 am

Post by MarketInSG » Sat Sep 21, 2013 9:47 pm

you have the profile table, am I right? Ensure they have all the correct columns.

Code: Select all

CREATE TABLE IF NOT EXISTS `oc_profile` (
  `profile_id` int(11) NOT NULL AUTO_INCREMENT,
  `sort_order` int(11) NOT NULL,
  `status` tinyint(4) NOT NULL,
  `price` decimal(10,4) NOT NULL,
  `frequency` enum('day','week','semi_month','month','year') NOT NULL,
  `duration` int(10) unsigned NOT NULL,
  `cycle` int(10) unsigned NOT NULL,
  `trial_status` tinyint(4) NOT NULL,
  `trial_price` decimal(10,4) NOT NULL,
  `trial_frequency` enum('day','week','semi_month','month','year') NOT NULL,
  `trial_duration` int(10) unsigned NOT NULL,
  `trial_cycle` int(10) unsigned NOT NULL,
  PRIMARY KEY (`profile_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `oc_profile_description`
--

CREATE TABLE IF NOT EXISTS `oc_profile_description` (
  `profile_id` int(11) NOT NULL,
  `language_id` int(11) NOT NULL,
  `name` varchar(255) NOT NULL,
  PRIMARY KEY (`profile_id`,`language_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
Your database is messed up


User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore

Post by OKI » Sat Sep 21, 2013 10:08 pm

Inside my profile table are these columns : But like before, it is without the oc prefix
product_id
profile_id
customer_group_id

Should I run a query with the code above?

I found an ocart.sql backup from 22 june. I had the host upload it with the hope that it would fix the problem.
No change in results. Same errors exist.
Last edited by OKI on Sat Sep 21, 2013 11:29 pm, edited 1 time in total.

OKI
Newbie

Posts

Joined
Thu Mar 29, 2012 1:37 am

Post by MarketInSG » Sun Sep 22, 2013 9:22 pm

no, your profile table is missing columns. Drop that table, and run the query above.


User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore

Post by OKI » Sun Sep 22, 2013 10:56 pm

Ok profile table dropped... query ran... columns added as previewed.
I am still having errors on both front and admin sides.

FRONT END No Change

Notice: Error: Unknown column 'pp.product_id' in 'where clause'
Error No: 1054
SELECT `pd`.* FROM `product_profile` `pp` JOIN `profile_description` `pd` ON `pd`.`language_id` = 1 AND `pd`.`profile_id` = `pp`.`profile_id` JOIN `profile` `p` ON `p`.`profile_id` = `pd`.`profile_id` WHERE `pp.product_id` = 100 AND `status` = 1 AND `customer_group_id` = 8 ORDER BY `sort_order` ASC in /home/produi5/public_html/system/database/mysql.php on line 50

ADMIN Side has changed.

Notice: Error: Unknown column 'pd.name' in 'field list'
Error No: 1054
SELECT `p`.`profile_id`, `p`.`sort_order`, `pd`.`name` FROM `profile` AS `p` JOIN `profile_description` AS `pd` ON `pd`.`profile_id` = `p`.`profile_id` AND `pd`.`language_id` = 1 ORDER BY p.sort_order ASC in /home/produi5/public_html/system/database/mysql.php on line 50

When we originally added the Profile table, at the same time we also added the profile_discription table. Could it be causing problems for the same reason... missing columns?

OKI
Newbie

Posts

Joined
Thu Mar 29, 2012 1:37 am

Post by MarketInSG » Mon Sep 23, 2013 8:40 am

you have a pretty bad screwed up table. Go ahead and download a new copy of v1.5.6, install on your local server to get the database structure


User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore

Post by OKI » Mon Sep 23, 2013 2:22 pm

Ok.... If you are in Singapore, then you are six hours ahead of me. I am still having my first cup of coffee, so I will research the details on setting up a server on my home system,, after my caffeine reservoir is sufficiently charged. I have been thinking about doing this for some time now. I just need to wait until my grey matter is alert enough for rational thought. My built-in database is screwed up too... at least before coffee. I will get back with you when I have the structure in place. This is a very good idea! Thank you.

OKI
Newbie

Posts

Joined
Thu Mar 29, 2012 1:37 am

Post by MarketInSG » Mon Sep 23, 2013 10:09 pm

try getting the structure, compare and edit accordingly on your live store to ensure it works as how a v1.5.6 should be like.


User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore
Who is online

Users browsing this forum: Majestic-12 [Bot] and 21 guests