Programatically modify related products in magento -
I am trying to manipulate program relations in the Magnori store.
I have read, there should be a way to go setRelatedLinkData.
As a simple test, I am just trying to replace products related to a product (i.e. an empty array), although this is not working - still in the product question Showing related product in backend.
The test code I am working with is:
As mentioned above, but whenever I reload it in backend, the product is also a related product.
Note: I just do not want to remove related products, in the end I also want to be able to add new people, so a DELTE FROM ... SQL query is not what I am looking for . However, if I can not work to remove the products, then definitely do not have to work to add them, so one step at a time: -)
The fastest way to use link processing is:
App / Code / Core / Dana / Catalog / Model / Resources / Products / LinkPPP saveProductLinks
// sample code $ product = Dana :: millmodel ('catalog / product') - & gt; Load (147); $ LinkData = array (); Dana :: getResourceModel ('catalog / product_link') - & gt; Savings Products Link ($ Product, $ Link Data, Mage_Catalog_Model_Product_Link :: LINK_TYPE_RELATED); and use the same code if you want to assign the product, but it should be $ linkData:
$ linkData = array ('145' =) & Gt; array ('position' => 1), '146' => array ('position' => 2));
Comments
Post a Comment