marellocommerce / marello

Marello
Other
51 stars 18 forks source link

Allow to set product sku of order item #37

Closed clicktrend closed 5 years ago

clicktrend commented 6 years ago

Function setProductSku does not exist in "OrderItem". "productSku" is set with

    /**
     * @ORM\PrePersist
     */
    public function prePersist()
    {
        // prevent overriding product name if already being set
        if (is_null($this->productName)) {
            $this->setProductName($this->product->getName());
        }
        $this->productSku  = $this->product->getSku();
    }

But I want to change order item e.g. customer wants a different one. Two options for suggestion

  1. add "@ORM\PreUpdate" to "public function prePersist()"
  2. add public setter for "productSku"
24198 commented 6 years ago

Hi @clicktrend,

Thank you for the feedback. The sole reason of the method not being in the OrderItem is because we've never planned on having the Order being able to be modified. In other words, we didn't take into account a possible Order edit and therefore there is no way to modify the existing items's SKU.

We currently have some scenario's and situations in which we probably will enable this in the future. We've been given some feedback that this would be a nice feature for managing purposes. So we have it on the roadmap as a possible option to have the ability to edit the Order up until a certain stage (i.e. if it's paid). So we're looking into it, but we don't have an ETA for it as of now, since we're investigating what the impact of such feature would be in the current application and setup.

Kind Regards,

Jaimy Casteleijn

24198 commented 5 years ago

Hi @clicktrend,

1.5.1 (https://github.com/marellocommerce/marello/tree/1.5.1) includes the setProductSku() on OrderItem level for you to use. Hopefully you'll find it useful in order to solve the challenges you've faced/ are facing.

Kind Regards,

Jaimy Casteleijn