Set product template data
436169
protected function setDataProductEditReview()
    {
        $product_id = $this->getData('review.product_id');

        $products = array();

        if (!empty($product_id)) {

            $product = $this->product->get($product_id);

            $options = array(
                'entity' => 'product',
                'entity_id' => $product_id,
                'template_item' => 'backend|content/product/suggestion'
            );

            $this->setItemThumb($product, $this->image, $options);
            $this->setItemPriceFormatted($product, $this->price);
            $this->setItemRendered($product, array('item' => $product), $options);
            $products = array($product);
        }

        $widget = array(
            'multiple' => false,
            'products' => $products,
            'name' => 'review[product_id]',
            'error' => $this->error('product_id')
        );

        $this->setData('product_picker', $this->getWidgetProductPicker($widget));
    }
345970
def _loaddata_template(self, stringbuffer, index, name, opts):
        
        context = self._get_dump_item_context(index, name, opts)

        stringbuffer.write(self.loadder_item_template.format(**context))

        return stringbuffer
1176791
function template(tmpl, data) {
  // Grab the template engine
  var engine = settings['template engine'];

  // Process the template through the template engine
  var content = engine.call(this, tmpl, data);

  // Return the content
  return content;
}
1346531
protected function setDataReviewsIndexProduct()
    {
        if ($this->config('review_enabled', 1) && !empty($this->data_product['total_reviews'])) {

            $pager_options = array(
                'key' => 'rep',
                'total' => $this->data_product['total_reviews'],
                'limit' => (int) $this->config('review_limit', 5)
            );

            $pager = $this->getPager($pager_options);

            $data = array(
                'product' => $this->data_product,
                'pager' => $pager['rendered'],
                'reviews' => $this->getReviewsProduct($pager['limit'])
            );

            $this->setData('reviews', $this->render('review/list', $data, true));
        }
    }
1028177
private function setSeoData($product)
    {
        $view = $this->view;
        $titleTemplateSetting = 'seo-title-template-' . Yii::$app->language;
        $descriptionTemplateSetting = 'seo-description-template-' . Yii::$app->language;

        if(!empty($product->translation->seoTitle)) {
            $title = $product->translation->seoTitle;
        }
        else if (Yii::$app->has('settings')
            && Yii::$app->settings->has('shop-product', $titleTemplateSetting)
            && !empty(Yii::$app->settings->get('shop-product', $titleTemplateSetting))) {
            $titleTemplate = Yii::$app->settings->get('shop-product', $titleTemplateSetting);
            $title = strtr($titleTemplate, [
                '{title}' => $product->translation->title
            ]);
        }
        else {
            $title = $product->translation->title;
        }

        if(!empty($product->translation->seoDescription)) {
            $description = $product->translation->seoDescription;
        }
        else if (Yii::$app->has('settings')
            && Yii::$app->settings->has('shop-product', $descriptionTemplateSetting)
            && !empty(Yii::$app->settings->get('shop-product', $descriptionTemplateSetting))) {
            $descriptionTemplate = Yii::$app->settings->get('shop-product', $descriptionTemplateSetting);
            $description = strtr($descriptionTemplate, [
                '{title}' => $product->translation->title
            ]);
        }
        else {
            $description = '';
        }

        $view->title = strip_tags(html_entity_decode($title));
        $view->registerMetaTag([
            'name' => 'description',
            'content' => strip_tags(html_entity_decode($description)) ?? ''
        ]);
        $view->registerMetaTag([
            'name' => 'keywords',
            'content' => strip_tags(html_entity_decode($product->translation->seoKeywords)) ?? ''
        ]);
    }
1282244
function(template, options){
			var payload = { data: {}, template_id: template };

			// Add root attributes to the payload root
			for(var attr in rootAttributes){
				if(!rootAttributes.hasOwnProperty(attr)){
					continue;
				}
				if(typeof options[attr] === 'undefined'){
					continue;
				}
				var key = rootAttributes[attr],
					val = options[attr];
				payload[key] = val;
				delete options[attr];
			}

			// Add any left over attribtues to the data object
			for(attr in options){
				if(!options.hasOwnProperty(attr)){
					continue;
				}
				payload.data[attr] = options[attr]
			}

			// Add to the list of emails
			this.mails.push(payload);
		}
1062996
def create_ad_product_set(name:, filter:)
      query = { name: name, filter: filter.to_json }
      result = AdProductSet.post("/#{id}/product_sets", query: query)
      AdProductSet.find(result['id'])
    end
1167033
public function setProduct($product)
    {
        $this->id = $product->getId();
        $this->sku = $product->getSku();
        $this->name = $product->getName();

        $this->status = $this->statusFactory->create()
            ->getOptionText($product->getStatus());

        $options = $this->visibilityFactory->create()
            ->getOptionArray();
        $this->visibility = (string)$options[$product->getVisibility()];

        $this->getMinPrices($product);

        $this->url = $this->urlFinder->fetchFor($product);

        $this->imagePath = $this->mediaConfigFactory->create()
            ->getMediaUrl($product->getSmallImage());

        $this->stock = (float)number_format($this->getStockQty($product), 2, '.', '');

        $shortDescription = $product->getShortDescription();
        //limit short description
        if ($this->stringUtils->strlen($shortDescription) > \Dotdigitalgroup\Email\Helper\Data::DM_FIELD_LIMIT) {
            $shortDescription = mb_substr($shortDescription, 0, \Dotdigitalgroup\Email\Helper\Data::DM_FIELD_LIMIT);
        }

        $this->shortDescription = $shortDescription;

        //category data
        $count = 0;
        $categoryCollection = $product->getCategoryCollection()
            ->addNameToResult();
        foreach ($categoryCollection as $cat) {
            $this->categories[$count]['Id'] = $cat->getId();
            $this->categories[$count]['Name'] = $cat->getName();
            ++$count;
        }

        //website data
        $count = 0;
        $websiteIds = $product->getWebsiteIds();
        foreach ($websiteIds as $websiteId) {
            $website = $this->storeManager->getWebsite(
                $websiteId
            );
            $this->websites[$count]['Id'] = $website->getId();
            $this->websites[$count]['Name'] = $website->getName();
            ++$count;
        }

        $this->processProductOptions($product);

        unset(
            $this->itemFactory,
            $this->mediaConfigFactory,
            $this->visibilityFactory,
            $this->statusFactory,
            $this->helper,
            $this->storeManager
        );

        return $this;
    }
1028886
public function addProductItemFieldData(ProductItemFieldData $productItemFieldData)
    {
        $productItemFieldData->setProduct($this);

        $this->productItemFieldDatas->add($productItemFieldData);

        return $this;
    }
545872
protected function setBreadcrumbEditProduct()
    {
        $breadcrumbs = array();

        $breadcrumbs[] = array(
            'url' => $this->url('admin'),
            'text' => $this->text('Dashboard')
        );

        $breadcrumbs[] = array(
            'text' => $this->text('Products'),
            'url' => $this->url('admin/content/product')
        );

        $this->setBreadcrumbs($breadcrumbs);
    }
23730
public function setTemplate(array $data, string $key): void
  {
    $this->templateData = $data;
    $this->templateKey  = $key;
  }
861494
function setData (moduleName, data) {
    // get module - throws error if not defined
    var module = getModule(moduleName)
    // set data
    module.meta.data = data
    // return module
    return ImmutableCore
}
1233660
protected function setListProductCategory()
    {
        $options = $this->query_filter;
        $options['placeholder'] = true;

        $conditions = array(
                'limit' => $this->data_limit,
                'category_id' => $this->data_category['category_id']) + $this->query_filter;

        $this->data_products = $this->getProducts($conditions, $options);
    }
978149
protected function setDataRecentIndexProduct()
    {
        $products = $this->getRecentProduct();

        if (!empty($products)) {

            $pager_options = array(
                'key' => 'pwp',
                'total' => count($products),
                'limit' => $this->config('product_view_pager_limit', 4)
            );

            $pager = $this->getPager($pager_options);

            if (!empty($pager['limit'])) {
                list($from, $to) = $pager['limit'];
                $products = array_slice($products, $from, $to, true);
            }

            $data = array('pager' => $pager['rendered'], 'products' => $products);
            $this->setData('recent', $this->render('product/recent', $data));
        }
    }
613193
public void setProduct(String product) {
        mProduct = product == null ? DEFAULT_PRODUCT : BDBProduct.forString(product);
    }
1317663
public function editTemplate()
    {
        $this->defaultData();

        $clazz = $this->getCurrentClass();
        $delivery = $this->getCurrentInstance();

        $formContainer = new DeliveryForm($clazz, $delivery);
        $myForm = $formContainer->getForm();

        $myForm->evaluate();

        if ($myForm->isSubmited()) {
            if ($myForm->isValid()) {
                $propertyValues = $myForm->getValues();

                // then save the property values as usual
                $binder = new tao_models_classes_dataBinding_GenerisFormDataBinder($delivery);
                $delivery = $binder->bind($propertyValues);

                // edit process label:
                $this->getClassService()->onChangeLabel($delivery);

                $this->setData("selectNode", tao_helpers_Uri::encode($delivery->getUri()));
                $this->setData('message', __('Delivery saved'));
                $this->setData('reload', true);
            }
        }

        $this->setData('contentForm', $this->getContentForm());

        $this->setData('uri', tao_helpers_Uri::encode($delivery->getUri()));
        $this->setData('classUri', tao_helpers_Uri::encode($clazz->getUri()));

        $this->setData('hasContent', !is_null($this->getClassService()->getContent($delivery)));

        $this->setData('formTitle', __('Delivery properties'));
        $this->setData('myForm', $myForm->render());

        if ($this->getServiceLocator()->get(\common_ext_ExtensionsManager::SERVICE_ID)->isEnabled('taoCampaign')) {
            $this->setData('campaign', \taoCampaign_helpers_Campaign::renderCampaignTree($delivery));
        }
        $this->setView('DeliveryTemplate/editDelivery.tpl');
    }
956358
function set_data($default_values) {
        if (!is_object($default_values)) {
            // we need object for file_prepare_standard_editor
            $default_values = (object)$default_values;
        }
        $editoroptions = $this->_customdata['editoroptions'];
        $default_values = file_prepare_standard_editor($default_values, 'summary', $editoroptions,
                $editoroptions['context'], 'course', 'section', $default_values->id);
        if (strval($default_values->name) === '') {
            $default_values->name = false;
        }
        parent::set_data($default_values);
    }