Create A Product Review In Magento - magento

I am trying to import product reviews from an older site to our new Magento site.
I am having troubles trying to create the actual product review in a script. Has anyone tried doing this before and know how to accomplish this?
It looks like reviews use the entity models and I can't seem to get the review object to do what I want it to do. Here is what I have tried doing so far and its throwing back some an error about foreign keys not being respected. Not sure how to make this work. Any help would be appreciated.
$review = Mage::getModel('review/review');
$review->setEntityPkValue(141292);
$review->setStatusId(1);
$review->setTitle("This is an inserted title");
$review->setDetail("This is an inserted detail");
$review->setNickname("First Last");
$review->save();

My guess would be that it's asking for a product and store to link the review with. Reading the install sql (under app/code/core/Mage/Review/sql/, it looks like there are constraints between review and each of:
core_store
catalog_product_entity
review_status
review_entity
Hope this helps,
JD

Related

Magento to Magento order import

I need to migrate orders table from one magento website to another magento website.
I have figured out tables in which table magento stores customer and order data.
'customer_address_entity'
'customer_address_entity_datetime'
'customer_address_entity_decimal'
'customer_address_entity_int'
'customer_address_entity_text'
'customer_address_entity_varchar'
'customer_eav_attribute'
'customer_eav_attribute_website'
'customer_entity'
'customer_entity_datetime'
'customer_entity_decimal'
'customer_entity_int'
'customer_entity_text'
'customer_entity_varchar'
'customer_form_attribute'
'customer_group'
'sales_bestsellers_aggregated_daily';
'sales_bestsellers_aggregated_monthly';
'sales_bestsellers_aggregated_yearly';
'sales_billing_agreement';
'sales_billing_agreement_order';
'sales_flat_creditmemo';
'sales_flat_creditmemo_comment';
'sales_flat_creditmemo_grid';
'sales_flat_creditmemo_item';
'sales_flat_invoice';
'sales_flat_invoice_comment';
'sales_flat_invoice_grid';
'sales_flat_invoice_item';
'sales_flat_order';
'sales_flat_order_address';
'sales_flat_order_grid';
'sales_flat_order_item';
'sales_flat_order_payment';
'sales_flat_order_status_history';
'sales_flat_quote';
'sales_flat_quote_address';
'sales_flat_quote_address_item';
'sales_flat_quote_item';
'sales_flat_quote_item_option';
'sales_flat_quote_payment';
'sales_flat_quote_shipping_rate';
'sales_flat_shipment';
'sales_flat_shipment_comment';
'sales_flat_shipment_grid';
'sales_flat_shipment_item';
'sales_flat_shipment_track';
'sales_invoiced_aggregated';
'sales_invoiced_aggregated_order';
'sales_order_aggregated_created';
'sales_order_aggregated_updated';
'sales_order_status';
'sales_order_status_label';
'sales_order_status_state';
'sales_order_tax';
'sales_order_tax_item';
'sales_payment_transaction';
'sales_recurring_profile';
'sales_recurring_profile_order';
'sales_refunded_aggregated';
'sales_refunded_aggregated_order';
'sales_shipping_aggregated';
'sales_shipping_aggregated_order';
But i don't know how I can do this, I have tried used to ignoring table but that's not working either.
Please let me know how should i proceed.
The following extension may help you.
http://www.magentocommerce.com/magento-connect/bulk-import-export-orders-to-csv.html
Select these tables and export them; then import in the other DB. If you are not very good in MySql you can use GUI tools like MySQL Workbench.

CSCART: How to create category programmatically

Can someone please help me to how to create a category programmatically in cs-cart?
I have tried to insert category details manually in database and it is displayed only in backend not in front end.
When i tried to edit it and save the category without giving any changes it shows the category in frontend...I dono what happen in that step.. please guide me
Check the tables you are updating (4):
*categories, *categories_descriptions, *product_sales and *product_categories,
I found the 'category_id' field in each one. May be it can help you. Or you can enable any MySQL logging system on saving in order to 'catch' any other tables involved in category info storing.

Joomla 'sobipro' - extracting data

I have taken over a Joomla project that needs rebuilding.
I need to get out the user data and some other data linked to users, I have found most of it in the jos_user table and also a table named jos_comprofiler.
There is data inside of jos_sobipro_field_data that I also need, but I do not know how this table related to anything else can someone please explain? I am able to write SQL and the JOIN statements to get it out once I understand how it all fits together.
Finally the table jos_comprofiler references an avatar which is an image name like '100_4f97c0b3c2c31.jpg' where can I find these images?
Thanks, Jake
I can tell you where those tables are coming from:
- jos_users is the user table used by Joomla core, together with jos_user_profiles for additional profile information.
- jos_comprofiler is a table created by the Community Builder extension from http://www.joomlapolis.com/.
- jos_sobipro_field_data is a table created by SobiPro from http://sobipro.sigsiu.net/
Maybe that helps you find the next steps. Maybe someone else knows more details.

RedSHOP - mod_products info needed

I'm terribly sorry to post this question here, but RedCOMPONENT just does not bother to answer my forum post or anyone else for that matter.
All I want to know, can this mod_products from RedCOMPONENT display featured products as well as products from a specific brand?
Thanks in advance.
You won't be able to do it with the extension you mentioned unless you code it yourself. I haven't looked into redSHOP majorly before and I;m not going to pay to download the module you mentioned, but in one of the PHP files, there will be some code retrieving the products from a specific table column using an SQL command. You could always try adapting this so that (if features products have their own table column) the SQL command retrieve products from both columns.
Else, you might be interested in this module which shows the features products for RedSHOP.
http://extensions.joomla.org/extensions/extension-specific/redshop-extensions/13964
You should use mod_redshop_featureproduct module.

When are Magento rule-based product relations worked out?

Magento's rule-based product relations (up-sell, cross-sell etc) are stored in a database table, and I assume they are updated once in a while. Unfortunately, I can't find any documentation about when that happens or what triggers it. Is it:
Cached, like a block, and expires after a certain time?
Generated whenever you save a product?
Generated by CRON?
I'd really appreciate it is someone could fill in the blanks for me. I'm using the Enterprise edition, if that helps or makes any difference.
So I dug around the product link data a bit. The relevant object we're looking at here is catalog/product_link, which the catalog/product object uses to retrieve linked object data.
While grouped and bundle products seem to write to this in cronjobs, I have not found any cases where this data is written in a cron-job for actual upsell/cross-sell products. I will keep digging a bit, but this seems to imply that the products are calculated at save time.
Hope that helps!
Thanks,
Joe
Search for the observers on events "catalog_product_save_before" and "catalog_product_save_after" to see in your project when it is fired and what function is called.
In the enterprise edition the observer fired is enterprise_targetrule/observer, function : catalogProductAfterSave ...

Resources