Cannot access Categories in dashboard (Magento) - php

So i have installed couple of extensions one of them was fontis feed generator, everything is working fine till i try and access Manage Categories the it comes up with "There has been an error processing your request"
The error is as follows
a:5:{i:0;s:110:"Source model "feedsgenerator/googleproducts_source_taxonomy" not found for attribute "google_product_category"";i:1;s:4101:"#0

Run this sql code to check if there's the attribute causing issues:
select * from eav_attribute where attribute_code = "google_product_category";
If you'll get a result showing the attribute then you should remove it. To do this you can do the following:
Add this to the end of your index.php file:
$installer = Mage::getResourceModel('catalog/setup','catalog_setup');
$installer->removeAttribute('catalog_category','google_product_category');
Run the website once with disabled cache (make sure the code run) and then remove the two lines from index.php.
This should be fixed now. You can check if the attribute still exists by running the sql code again:
select * from eav_attribute where attribute_code = "google_product_category";

Related

How to create a product options prices by customer group wise in opencart 2.3.0.2

I created two group one is A and other is B . i want there multiple option as each have different prices as acording to customer group i have some code but it does not run properly it give a message as "Call to undefined method Cart\Customer::getCustomerGroupId() in C:\xampp\htdocs\postal\vqmod\vqcache\vq2-catalog_model_catalog_product.php on line 340".
the code is in vqmod xml file -enter code here
problem is there i can not know how to definde customer group id and this code is running in old version perfectly
the code is attach in link -- product-option by download-customer group
please check this and send me how to define and fix the bug.
the code run proper before login- wen i login then give error message.
I suggest to modify system\library\cart\customer.php to:
/create a function/
public function getCustomerGroupId() {
return $this->customer_group_id;
}

Prestashop : use Product class in personnal script

I need to create a cron script to process products (add, delete, update) when I get them from a raw data file from a third party firm which sends a new file (data separated with ;) whenever a product is changed (added, deleted, updated).
I tried using the Product class (from Product.php) to add new products in the shop. The problem at first was that I got this error :
class 'ObjectModel' not found in importProducts.php
I found an apparent solution, which was to require_once the config and init file from the config folder in importProduct.php :
require_once(dirname(__FILE__).'/../config/config.inc.php');
require_once(dirname(__FILE__) . '/../init.php');
The require points to the right files. My file is located in a new folder, called "crontasks".
prestashop/crontaskt/import.php
(import.php starts importProduct.php)
But now there is a new error :
Fatal error: Uncaught You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 7
SELECT c.id_category
FROM ps_category_product cp
LEFT JOIN ps_category c ON (c.id_category = cp.id_category)
INNER JOIN ps_category_shop category_shop ON (category_shop.id_category = c.id_category AND category_shop.id_shop = 1)
WHERE cp.id_category NOT IN (18)
AND cp.id_product = thrown in D:\Travail\BUSCI\prestashop\prestashop\classes\db\Db.php on line 791
(they don't appear, but around the query are < br />< br />< pre >...< /pre > without the spaces in it)
Problem is, I checked in the database, and the columns are all there, and I don't get why there is a problem on that line.
Also, I could not find from which file that query was. I looked in Product.php, and I found one very similar but not exactly the same :
$result = Db::getInstance()->executeS('
SELECT c.`id_category`
FROM `'._DB_PREFIX_.'category_product` cp
LEFT JOIN `'._DB_PREFIX_.'category` c ON (c.`id_category` = cp.`id_category`)
'.Shop::addSqlAssociation('category', 'c', true, null, true).'
WHERE cp.`id_category` NOT IN ('.implode(',', array_map('intval', $categories)).')
AND cp.id_product = '.$this->id
);
line 1051 in Product.php, method updateCategories.
I could not find anything similar in Category.php or any other file I looked in. But this query is missing the inner join, so I don't know if that's really the one. I suppose the problem comes from the fact that there is nothing after the =, but I don't know if that's just a character limitation (amount of characters printed in an error) or if it is the error. I'm feeling a little lost.
I did not change any files from prestashop. This is the latest update I just installed a week ago on my computer. The tests are done in local, on my computer.
I would really appreciate some help.
Excuse me for my english, it's not amazing.
Edit :
So I searched through the whole project, in every file for the line
INNER JOIN '._DB_PREFIX_.'category_shop
and could not find it. I tried taking away the extra spaces, just in case, but could not find the file in which this sql query is in.

Drupal 7.x: how to create a new node with PHP input format?

I want execute custom PHP script that will delete all nodes of a particular type (Feed items).
How to create a new node with PHP input format, so I can paste code into the node body? Please specify detailed steps.
$node_type = 'Feed items';
//fetch the nodes we want to delete
$result = db_query("SELECT nid FROM {node} WHERE type='%s'",$node_type);
while ($row = db_fetch_object($result)){
node_delete($row->nid);
$deleted_count+=1;
}
//simple debug message so we can see what had been deleted.
drupal_set_message("$deleted_count nodes have been deleted");
It's not entirely clear what you want to achieve. Do you simply want to execute that PHP code, once? Or whenever a node of a certain type is created?
If you just want to execute the PHP code once, you can install the devel module (http://drupal.org/project/devel) and paste your code in <your_site_url>/devel/php
--EDIT
Another option would be to create a php page that bootstraps Drupal and runs your code:
http://www.avenuewebmedia.com/drupalbootstrap-connect-drupal-external-php-script
OK, I managed myself how to do this: I had to enable the "PHP filter" module first (in Drupal core, disabled by default). In admin > Configuration > Content authoring > Text formats > Add text format, in "Enabled filters" mark "PHP evaluator", in Roles select 'admin', save configuration.
Then I created a new node (article), set the input format to PHP, pasted the code into the node body, added a title and clicked submit. Code has been executed. Sure, we need to delete the node when done.

WordPress deactivate a plugin via database?

I have a wordpress script, wp-supercache, that I need to disable (as its cached on a nasty error), however, the error is causing the wp-admin redirect to fail, which means I can't get into the site to disable the plugin.
Any advice? I can access the database via cpanel.
Try re-naming the folder of the plugin and then see if error is gone (make backup first of course.). If that does not help, here is the solution then.
To disable a specific plugin, you have to remove it from the serialized string that stores the list of all plugins - that's set in the option_value column of the wp_options table as discussed by #TimDurden. The specific format change you have to make is, taken shamelessly from teh Internet:
a:4:{
i:0;s:19:"akismet/akismet.php";
i:1;s:36:"google-sitemap-generator/sitemap.php";
i:2;s:55:"google-syntax-highlighter/google_syntax_highlighter.php";
i:3;s:29:"wp-swfobject/wp-swfobject.php";
}
That first set of characters - a:4 - designates an array and its length. Note also that each line in the list of plugins has an index. So:
Decrement the index (from 4 to 3 in this case)
In each line, decrement the number after the i:
Remove the specific plugin you want to disable.
Update the value in the db using the new string you constructed from these steps:
update wp_options set option_value=<new value> where option_id=<id of this option>
Note that your table name might not be wp_options - you might have a prefix to add.
You only need to rename the folder in /wp-content/plugins/ and the plugin will be automatically de-activated. Once it is de-activated, you will be able to login.
Backup database or just the wp_options table
SELECT option_value FROM wp_options WHERE option_name = 'active_plugins';
Copy selected string (serialized string) and paste in the left side at https://serializededitor.com/
Remove the line which plugin you want to deactivate
Copy the serialized result string from the right side and update active_plugins value with it.
UPDATE wp_options
SET option_value = 'THE_NEW_SERIALIZED_STRING'
WHERE option_name = 'active_plugins' LIMIT 1;
I wrote a little exe in .dot to repair/remove options string from database.
Download exe here
Run on MySQL server
SELECT * FROM wp_options WHERE option_name = 'active_plugins';
Paste Results in textbox, press parse.
Remove the ones you don't want.
Click output, it copies output to clipboard
replace brackets inside the single quotes below with output and Run on MySQL server
UPDATE wp_options SET option_value = '[replace inside single quotes with your output' WHERE option_name = 'active_plugins';
No warranties... I don't claim to be programmer
To disable all Wordpress plugins on your site:
Login to your database management tool (e.g. PHPMyAdmin)
Execute the following query:
UPDATE wp_options SET option_value = '' WHERE option_name = 'active_plugins';
Another way to do this is you can backup the site and then just rename the folder of the plugin under /wp-content/plugins/ to some other name . So the plugin will be disabled.
I wont prefer deleting the plugin folder as it may cause errors.
After the step is done log in to your wordpress site and delete the plugin from there
You just need to change the values in the record "active_plugins" in the database. You can find the process Here
Late answer,but answering as it will be useful to someone in the future. All the plugins are stored in the wp_options table in a serialized manner. U can edit this field manually. Or if you unserialize it using a function like in php using unserialize(), you will get an array. just modify it to remove the plugin you want to remove from that array, and serialize it back. then update the table. Thats it. If you want to know more about it here is a good article. It explains all about this.
Using this code you can activate your plugin from the functions.php:
function activate_plugin_via_php() {
$active_plugins = get_option( 'active_plugins' );
array_push($active_plugins, 'unyson/unyson.php'); /* Here just replace unyson plugin directory and plugin file*/
update_option( 'active_plugins', $active_plugins );
}
add_action( 'init', 'activate_plugin_via_php' );

phpmyadmin - default to structure instead of browse

Can I set the default in phpMyAdmin to open in structure instead of browse?
thanks
If perchance you are using the "quick access icon" next to the table name in the navigation frame, this may be configured.
From the configuration file documentation:
$cfg['LeftDefaultTabTable'] string
Defines the tab displayed by default when clicking the small icon
next to each table name in the
navigation panel. Possible values:
"tbl_structure.php", "tbl_sql.php",
"tbl_select.php", "tbl_change.php" or
"sql.php".
For MAMP 3.x the DefaultTabTable configuration parameter applies. It needs to be set in MAMP/bin/phpMyAdmin/config.inc.php, e.g.:
$cfg['DefaultTabTable'] = 'sql.php';
As I said in my comment, you can click on the little table icon to the left of the table name (assuming, as Mike B said, we are talking about the table list on the left) and it will open up the table structure page.
AFAIK, switching the behavior on those links is not possible through a configuration directive. You would have to dig through the code and change it in there. Shouldn't be too complicated, though.
Add:
$cfg['DefaultTabTable'] = 'tbl_structure.php';
To either config.inc.php or config.default.php.
You can also change LeftDefaultTabTable which changes the icon. The options are:
'tbl_structure.php' = fields list
'tbl_sql.php' = SQL form
'tbl_select.php' = search page
'tbl_change.php' = insert row page
'sql.php' = browse page
In phpMyAdmin 4.8.2...
Click the double gears icon at the top of the left navigation pane.
Then click the "Tables" tab within the popup modal. (last tab)
There you can set the "Target for quick access icon" setting, which is referring to the little index card icon to the left of the table links in the left pane.
I didn't see any settings to change the default link behavior, but you can also add an additional "Target for second quick access icon" and define it's default view behavior differently if desired. It adds an additional "Quick access" icon to the left of the table links with your chosen behavior.
I use an old version of XAMPP (1.6.7) which contains an old version of phpMyAdmin (2.11.7), but the following worked for me.
In the /phpmyadmin/libraries/config.default.php file there is a section of code that handles how the table is viewed.
Change the last two lines of code to suit your purposes, for mine I wanted to open tables in "Browse" view, not "Structure" view (which was my default).
/**
* Possible values:
* 'tbl_structure.php' = fields list
* 'tbl_sql.php' = SQL form
* 'tbl_select.php' = select page
* 'tbl_change.php' = insert row page
* 'sql.php' = browse page
*
* #global string $cfg['DefaultTabTable']
*/
// Show table Structure - Default
$cfg['DefaultTabTable'] = 'tbl_structure.php';
// Uncomment below to show table data
// $cfg['DefaultTabTable'] = 'sql.php';
Save this config file and refresh PhpMyAdmin in your browser.
Hope that helps!
In version 3.5.1: go to the PhpMyAdmin home page -> Settings -> Navigation Frame -> Tables tab. Here you will find an option "Target for quick access icon", and set it
"sql.php" if you want it to go to the Browse tab
"tbl_structure.php" if you want it to go to the Structure tab
"tbl_sql.php" if you want it to go to the SQL tab
"tbl_select.php" if you want it to go to the Search tab
"tbl_change.php" if you want it to go to the Insert tab.
Then Save.
This way when you will click on the table name, it will go to the structure; and when clicking on the little icon before the table name, it will go to the tab you just set.
navigation.php
Around Line #646 in phpMyAdmin version 3.3.8
Insert
$href = $GLOBALS['cfg']['LeftDefaultTabTable'] . '?'
. $GLOBALS['common_url_query']
.'&table=' . urlencode($table['Name'])
.'&goto=' . $GLOBALS['cfg']['LeftDefaultTabTable'];
AFTER
$href = $GLOBALS['cfg']['DefaultTabTable'] . '?'
.$GLOBALS['common_url_query'] . '&table='
.urlencode($table['Name']) . '&pos=0';
to make the text field name link in the navigation to behave the same as the little icon to the left of it.
In my version, the configuration setting for it is supposed to be
$cfg['DefaultTabTable'] = 'tbl_structure.php';
It is listed in sample config file. However, /libraries/navigation/Nodes/Node_Table.class.php on line 34 ignores this setting and uses 'sql.php' directly. I changed that line to
'text' => $GLOBALS['cfg']['DefaultTabTable'].'?server=' . $GLOBALS['server']
On that line and it works fine for me.
Go to phpMyAdmin/config.inc.php
find line starting
$cfg['DefaultTabTable']
and set it to value
$cfg['DefaultTabTable'] = 'browse';
Restart Apache, empty session data (second icon under phpMyAdmin logo, alternatively log-out and log-in, not sure if this step is needed, some configs are cached in user's session)
This solved the issue in MAMP 5.7 (i.e. if you click on table name in left navigation tree, the Browse tab is open). PhpMyAdmin is located in MAMP/bin folder
I was following the instructions from etheros and wasn't able to find that configuration option, but it can just be added (to the confic.inc.php file). In my config file, I added it to the "Left frame setup" section, around line 160.
Depending on the phpMyAdmin version either of these should work:
$cfg['LeftDefaultTabTable'] = 'tbl_structure.php';
$cfg['NavigationTreeDefaultTabTable'] = 'tbl_structure.php';
Also you may actually be saving these setting in the phpmyadmin database, table=pma__userconfig. Go ot the phpmyadmin home and click Settings -> Navigation Frame ->Tables -> Target for quick access icon

Categories