<?php

namespace KupShop\ContentBundle\View;

use KupShop\KupShopBundle\Views\View;

class DeliveryTimeView extends View
{
    protected $template = 'product/product.ajax.deliveryTime.tpl';

    protected $variationId;
    protected $productId;

    public function setVariationId($id)
    {
        $this->variationId = $id;
    }

    public function setProductId($idp)
    {
        $this->productId = $idp;
    }

    public function getBodyVariables()
    {
        $vars = parent::getBodyVariables();

        if ($this->variationId) {
            $product = new \Variation();
        } else {
            $product = new \Product();
        }

        $product->variationId = $this->variationId;
        $product->createFromDB($this->productId);
        $product->prepareDeliveryText();

        $vars['product'] = $product;

        return $vars;
    }

    public function getShowInSearch(): bool
    {
        return false;
    }
}
