I want to remove the field PHONE and FAX from the Magento customer administration. I already removed all the fields and validations in the frontend, but this field is still in the backend
Thanks!
Try to delete them from DB.
Table eav_attribute.
Check entity_type_id firstly - it need to belong to customer_address;
SELECT entity_type_id FROM `eav_entity_type` WHERE entity_type_code = 'customer_address'
DELETE from eav_attribute where attribute_code IN ('telephone', 'fax') AND entity_type_id = ? (from previous query)
No code changes will be needed then.
Backup your DB firstly.
You should comment out the relevant lines of code in Adminhtml folder on approperiate place, suggesting you as for the front end , you already have done this, so let the exact path on you
rather then deleting from db, a better way would be commenting the relevant lines of code. as if something goes wrong, Mag will reload the db from the default script and the fields you deleted will appear again..
HTH...
Not much effort is required , just run these SQL commands
SELECT * FROM `eav_attribute`
Now look for Telephone under attribute_code, mostly its with attribute_id 31
Update the table using the following SQL statement
UPDATE `eav_attribute` SET `is_required` = '0' WHERE `eav_attribute`.`attribute_id` =31;
Related
Magento reviews follow this format:-
Summary
Body of Review
Date of Review
I need to change the date of the review to a custom date.
Please could somebody guide me on how to go about doing this? I have tried editing the review in the back-end, but the only sections I can change are the Summary and the Body of the review.
If you could let me know where in the database I should change, I'd really appreciate it. Or, if there is a way to change this in the back-end, without installing an extension, that'd be really awesome.
Preface
The Magento Admin backend does not have a place to edit the date of a product review. You must do this directly in the SQL database or programmatically.
The following instructions will help you change it directly in the SQL database.
1.) Find The Review ID
Login to your Magento backend Admin area and go here in the menu:
Magento Admin >> Catalog >> Reviews and Ratings >> Customer Reviews >> All Reviews
In the resulting table of all reviews, find the single review you want to change the date for. Do not click into the review because the ID is only shown in the table of all reviews.
Remember that ID
2.) Change the Date in the Database
I used PhpMyAdmin to get access to my Magento SQL database. You can use whatever SQL Management Platform suits you.
Login to your SQL database and navigate the the table named only 'review'.
In that table you will see a column called 'review_id'.
Find the row in the 'review.review_id' column that matches the ID of the review you want to change the Magento date for.
Click 'Edit' on that row and change the 'created_at' value of it.
Save your changes to the row by clicking 'Go'.
You're done.
Check Magento to make sure it displays the updated date.
Helpful Hints
The date value in 'created_at' must be in the format of an SQL date-time. This is 'YYYY-MM-DD hh:mm:ss'.
Magento is sensitive to timezones. You may need to adjust the date value you use to compensate for this - so it displays the way you want it.
The SQL 'review' table was not listed on my first page of table names in PhpMyAdmin. To find it, I had to click through to the second page of table names.
It is very easy to ruin your website by clicking the wrong things in PhpMyAdmin. So don't screw around in there.
I'd think by directly manipulating the reviews details from Databaes. Although this seems to be discouraged but since it may be one or two records, then creating a custom solution is not feasible.
Running this MySQL to fetch the reviews info from the DB may help you locate the review you are trying to edit.
SELECT
rd.`detail_id`,
rd.`review_id`,
r.`created_at`,
rd.`title`,
rd.`detail`,
rd.`nickname`,
r.`review_id`
FROM
`review_detail` rd
LEFT JOIN review r
ON rd.`review_id` = r.`review_id`
ORDER BY rd.`detail_id` DESC
You can set all Magento 1.x reviews to the order created date us this:
START TRANSACTION;
UPDATE review r INNER JOIN review_detail rd ON (rd.review_id = r.review_id AND r.entity_id = 1) INNER JOIN sales_flat_order_item oi ON (oi.product_id = r.entity_pk_value) INNER JOIN sales_flat_order as o ON (o.entity_id = oi.order_id) SET r.created_at = o.created_at;
SELECT r.review_id, r.created_at as review_date, o.created_at as order_date, o.increment_id, oi.sku FROM review r INNER JOIN review_detail rd ON (rd.review_id = r.review_id AND r.entity_id = 1) INNER JOIN sales_flat_order_item oi ON (oi.product_id = r.entity_pk_value) INNER JOIN sales_flat_order as o ON (o.entity_id = oi.order_id) GROUP BY oi.product_id ORDER BY r.created_at DESC;
COMMIT;
Tested and verified on Magento 1.9.x
We're a few years and 11,000+ products into our Magento store and we had to shift gears a bit.
Life would be easier if the values (titles, enabled/disabled, descriptions) used in the Store View could overwrite the Default Values without endless hours of copy/pasting.
So, if the Store View Value is different than the Default Value, make that the Default Value. Help appreciated!
This can be done directly with SQL, but be sure to set maintenance mode and backup before you start.
SET #default = 0;
SET #store = 1;
-- put the correct store_id here
START TRANSACTION;
INSERT INTO `catalog_product_entity_int` (entity_type_id, attribute_id, store_id, entity_id, value)
SELECT entity_type_id, attribute_id, #default, entity_id, value FROM `catalog_product_entity_int` AS local
WHERE store_id = #store
ON DUPLICATE KEY UPDATE value = local.value;
-- the "ON DUPLICATE..." part works because EAV tables have
-- a unique key for "entity_id, attribute_id, store_id"
DELETE FROM `catalog_product_entity_int`
WHERE store_id = #store;
-- it is safe to delete #store rows because all values
-- have been either copied or updated by now
COMMIT;
Repeat the above for all catalog_product_entity_* tables. Then rebuild indexes, you can do that while the site is in maintenance mode with SSH...
cd path/to/magento/shell/
php indexer.php --reindex catalog_product_attribute
I wrote a PHP script that goes through the storeview values, copies them to default scope if they are different and then deletes the local value.
You can see the GIST here: https://gist.github.com/janzikmund/a92e0a219af5e362fa1293b52b6b831e .
It is commented to give you the idea. At the bottom the UPDATE and TRUNCATE lines are commented out, so you should be able to first run it without any data modification and then when you are sure uncomment these lines and transform the data.
Of course don't forget to do a backup first!
How to see Table detail when writing query?
Hi, i am new to using Embarcadero DBArtisan for Oracle and Syabase queries executions.
but i am unable to see the tables and fields information when i write queries.
Forexample:
Databasname.User.Table.Fields
Suppose if i write first Database name and write .(dot) it should show me all users and when i pick one user and write .(dot) agian it should show me all tables inside and when i pick one table and write .(dot) it should show me all the fields inside.
But it is not doing that way. every time i have to describe table to find the specific field in the table.
I am woundering if i have to choose some option to see this information.
Thank you very much for your help.
Sybase, there is no User.
I think you have to write a cursor to loop over the DBs on a server.
For the rest of your question:
select db_name() 'databasename', b.name 'table', a.name 'fields'
from syscolumns a, sysobjects b
where a.id = b.id
-- and b.type = 'U' -- User tables only
It seems that there is a setting in Code Workbench. Please see page 733 in the DBArtisan User Guide.
From the Manual,
In the ISQL Window, when Enable Auto Replacement is selected on the Setting Tab,
the application uses "dot completion" auto population to display the list of columns
for the target table.
I have this sql statement setup in my old code and want to move it over to active record, the problem that I'm phased with is how do I do a
SELECT news_items.id FROM
(SELECT news_items.* FROM news_items
JOIN feeds ON feeds.id=news_items.feed
LEFT JOIN news_item_country ON news_item_country.id=news_items.country
WHERE news_items.id=30758
ORDER BY date_item DESC )
AS news_items
GROUP BY news_items.id
ORDER BY date_item DESC
Trying to do this with Active Record, first I created the select that goes inside the select at least that is what I think needs to be done.
$news_items = $this->db->select('default_news_items.*')
->from('default_news_items ')
->join('default_feeds','default_feeds.id=default_news_items.feed')
->join('default_news_item_country','default_news_item_country.id=default_news_items.country','left')
->join('default_news_item_options','default_news_item_options.id=default_news_items.options','left')
->where($where)
->order_by('date_item DESC')
->limit($limit)
->get();
Next I create the actual select and reference the other select inside the from
if ($query = $this->db->select("
news_items.id,
->from($news_items)
->group_by('news_items.id')
->get()) {
It did not work, so I'm asking if someone have experiences with this and how to do it?
You can't do a subquery directly in native active record syntax. Check out this answer for a solution:
subquery in codeigniter active record
(The author wrote a library for active record subqueries http://labs.nticompassinc.com/CodeIgniter-Subqueries/ )
Without this or similar technique you need to keep your current select code at least for the subquery ($news_items).
Take a look at this answer of mine this might help how you can achieve it.
Using Mysql WHERE IN clause in codeigniter
I'm trying to isolate duplicates in a 500MB database and have tried two ways to do it. One creating a new table and grouping:
CREATE TABLE test_table as
SELECT * FROM items WHERE 1 GROUP BY title;
But it's been running for an hour and in MySQL Admin it says the status is Locked.
The other way I tried was to delete duplicates with this:
DELETE bad_rows.*
from items as bad_rows
inner join (
select post_title, MIN(id) as min_id
from items
group by title
having count(*) > 1
) as good_rows on good_rows.post_title = bad_rows.post_title;
..and this has been running for 24hours now, Admin telling me it's Sending data...
Do you think either or these queries are actually still running? How can I find out if it's hung? (with Apple OS X 10.5.7)
You can do this:
alter ignore table items add unique index(title);
This will add a unique index and at the same time remove any duplicates, which will prevent any future duplicates from occurring. Make sure you do a backup before running this command.