2

We are displaying "SAVE DESIGN" button in Product view page. once Registered customer click on that button, we want to create new product with same product details with different [ random] sku. we want to display those products in custom tab under "My account" similar to "My wishlist".

0
3
+100

this is not a full solution, but some puzzle pieces you can put together.
There should already be a lot of scripts out there to create a product programattically. Here is just one from inchoo but you can look for others.

What you have to change.

You need to set the random SKU.

$sku = call your method to generate the sku.
$product->setSku($sku);

And you could add a new product attribute that is a reference to the customer id.

Let's say the attribute is called created_by_customer_id.

You will have to get the customer id from the session and set it on the product before calling save.

$customerId = Mage::getSingleton('customer/session')->getCustomerId();
$product->setCreatedByCustomerId($customerId);

And to display the products in the customer account you need to add a new menu item to account navigation.

And in the controller action that is linked to the menu can load a block that gets the products collection associated to the current user.

public function getCustomerProducts() 
{
    $customerId = Mage::getSingleton('customer/session')->getCustomerId();
    $products = Mage::getModel('catalog/product')->getCollection()
         ->addAttributeToSelect('*')
         ->addAttributeToFilter('created_by_customer_id', $customerId);
    return $products;
}

The template is up to you.
You can just loop through the products:

<?php foreach ($this->getCustomerProducts() as $product) :?>
    <!-- your html here -->
<?php endforeach;?>
1
  • Those puzzle pieces are valuable as diamonds..... you are the ultimate..... Mar 15 '17 at 13:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.