本文整理汇总了PHP中Combination::getWsImages方法的典型用法代码示例。如果您正苦于以下问题:PHP Combination::getWsImages方法的具体用法?PHP Combination::getWsImages怎么用?PHP Combination::getWsImages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Combination
的用法示例。
在下文中一共展示了Combination::getWsImages方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setProduct
public function setProduct($product, $combination)
{
// create the product
$context = Context::getContext();
$this->give_it_product = new GiveItSdkProduct();
$this->give_it_product->setCurrency($context->currency->iso_code);
$usetax = Product::getTaxCalculationMethod((int) $context->customer->id) != PS_TAX_EXC;
if ($combination['id_product_attribute'] == 0) {
$combination['attributes'] = '';
$image = Product::getCover($product->id);
} else {
$comb = new Combination($combination['id_product_attribute']);
if ($image = $comb->getWsImages()) {
$image = $image[0];
$image['id_image'] = $image['id'];
}
}
$image['id_product'] = $product->id;
$image['id_image'] = Product::defineProductImage($image, Context::getContext()->language->id);
$img_profile = version_compare(_PS_VERSION_, '1.5', '<') ? 'home' : ImageType::getFormatedName('medium');
$image = $image ? $context->link->getImageLink($product->link_rewrite, $image['id_image'], $img_profile) : '';
// first, set the product details.
$this->give_it_product->setProductDetails(array('code' => $product->id . '_' . $combination['id_product_attribute'], 'price' => (int) (Product::getPriceStatic((int) $product->id, $usetax, $combination['id_product_attribute']) * 100), 'name' => $product->name . ($combination['attributes'] ? ' : ' . $combination['attributes'] : ''), 'image' => $image));
$delivery = $this->setDelivery();
// add the delivery option to the product
$this->give_it_product->addBuyerOption($delivery);
//We should validate this product
$this->product_valid = $this->give_it_product->validate();
}
示例2: generateProductAttributesData
protected function generateProductAttributesData()
{
$delimiter = ';';
$line = array();
$titles = array();
$new_path = new Sampledatainstall();
$f = fopen($new_path->sendPath() . 'output/product_attributes.vsc', 'w');
foreach ($this->product_attribute_fields as $field => $array) {
$titles[] = $array['label'];
}
fputcsv($f, $titles, $delimiter, '"');
$product_attributes = $this->getAllProductsAttributes();
if ($product_attributes) {
foreach ($product_attributes as $product_attribute) {
$pa = new Combination($product_attribute);
foreach ($this->product_attribute_fields as $field => $array) {
$line[$field] = property_exists('Combination', $field) && !is_array($pa->{$field}) && !Tools::isEmpty($pa->{$field}) ? $pa->{$field} : '';
}
$value = $this->getAttributeValues($pa->id);
$line['values'] = $value ? implode(',', $value) : '';
$attr_images = array();
$images = $pa->getWsImages();
foreach ($images as $image) {
$attr_images[] = $image['id'];
}
$line['image'] = $attr_images ? implode(',', $attr_images) : '';
if (!$line[$field]) {
$line[$field] = '';
}
fputcsv($f, $line, $delimiter, '"');
}
}
fclose($f);
}