本文整理汇总了PHP中Pim\Bundle\CatalogBundle\Model\ProductInterface::isEnabled方法的典型用法代码示例。如果您正苦于以下问题:PHP ProductInterface::isEnabled方法的具体用法?PHP ProductInterface::isEnabled怎么用?PHP ProductInterface::isEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pim\Bundle\CatalogBundle\Model\ProductInterface
的用法示例。
在下文中一共展示了ProductInterface::isEnabled方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function it_normalizes_an_existing_product_into_mongodb_document($mongoFactory, $serializer, ProductInterface $product, \MongoId $mongoId, \MongoDate $mongoDate, Association $assoc1, Association $assoc2, CategoryInterface $category1, CategoryInterface $category2, GroupInterface $group1, GroupInterface $group2, ProductValueInterface $value1, ProductValueInterface $value2, FamilyInterface $family)
{
$mongoFactory->createMongoId('product1')->willReturn($mongoId);
$mongoFactory->createMongoDate()->willReturn($mongoDate);
$family->getId()->willReturn(36);
$category1->getId()->willReturn(12);
$category2->getId()->willReturn(34);
$group1->getId()->willReturn(56);
$group2->getId()->willReturn(78);
$product->getId()->willReturn('product1');
$product->getCreated()->willReturn(null);
$product->getFamily()->willReturn($family);
$product->isEnabled()->willReturn(true);
$product->getGroups()->willReturn([$group1, $group2]);
$product->getCategories()->willReturn([$category1, $category2]);
$product->getAssociations()->willReturn([$assoc1, $assoc2]);
$product->getValues()->willReturn([$value1, $value2]);
$context = ['_id' => $mongoId];
$serializer->normalize($product, 'mongodb_json')->willReturn(['data' => 'data', 'completenesses' => 'completenesses']);
$serializer->normalize($value1, 'mongodb_document', $context)->willReturn('my_value_1');
$serializer->normalize($value2, 'mongodb_document', $context)->willReturn('my_value_2');
$serializer->normalize($assoc1, 'mongodb_document', $context)->willReturn('my_assoc_1');
$serializer->normalize($assoc2, 'mongodb_document', $context)->willReturn('my_assoc_2');
$this->normalize($product, 'mongodb_document')->shouldReturn(['_id' => $mongoId, 'created' => $mongoDate, 'updated' => $mongoDate, 'family' => 36, 'enabled' => true, 'groupIds' => [56, 78], 'categoryIds' => [12, 34], 'associations' => ['my_assoc_1', 'my_assoc_2'], 'values' => ['my_value_1', 'my_value_2'], 'normalizedData' => ['data' => 'data'], 'completenesses' => []]);
}
示例2:
function it_does_not_generate_association_calls_for_given_products_if_associated_product_is_not_complete_nor_enable($webservice, ProductInterface $product, ProductInterface $associatedProduct, Association $association, AssociationType $associationType, Completeness $completeness)
{
$webservice->getAssociationsStatus($product)->willReturn(['up_sell' => [], 'cross_sell' => [['sku' => 'sku-011']], 'related' => []]);
$product->getIdentifier()->willReturn('sku-012');
$product->getAssociations()->willReturn([$association]);
$association->getAssociationType()->willReturn($associationType);
$association->getProducts()->willReturn([$associatedProduct]);
$associatedProduct->getIdentifier()->willReturn('sku-011');
$associatedProduct->isEnabled()->willReturn(false);
$associatedProduct->getCompletenesses()->willReturn([$completeness]);
$completeness->getRatio()->willReturn(50);
$associationType->getCode()->willReturn('UPSELL');
$this->process([$product])->shouldReturn(['remove' => [['type' => 'cross_sell', 'product' => 'sku-012', 'linkedProduct' => 'sku-011', 'identifierType' => 'sku']], 'create' => []]);
}
示例3: array
function it_normalizes_product(SerializerInterface $serializer, ProductInterface $product, FamilyInterface $family, Completeness $completeness)
{
$serializer->implement('Symfony\\Component\\Serializer\\Normalizer\\NormalizerInterface');
$this->setSerializer($serializer);
$product->getFamily()->willReturn($family);
$product->getGroups()->willReturn([]);
$product->getValues()->willReturn([]);
$product->getCompletenesses()->willReturn([$completeness]);
$product->getCreated()->willReturn(null);
$product->getUpdated()->willReturn(null);
$product->isEnabled()->willReturn(true);
$serializer->normalize($family, 'mongodb_json', [])->willReturn('family normalization');
$serializer->normalize($completeness, 'mongodb_json', [])->willReturn(['completenessCode' => 'completeness normalization']);
$this->normalize($product, 'mongodb_json', [])->shouldReturn([ProductNormalizer::FAMILY_FIELD => 'family normalization', ProductNormalizer::COMPLETENESSES_FIELD => array('completenessCode' => 'completeness normalization'), ProductNormalizer::ENABLED_FIELD => true]);
}
示例4: getDefaultDrupalProduct
/**
* @param $product
* @return array
*/
public function getDefaultDrupalProduct(ProductInterface $product)
{
$labels = [];
$attributeAsLabel = $product->getFamily()->getAttributeAsLabel();
$availableLocales = $attributeAsLabel->getAvailableLocales();
if (!is_null($availableLocales)) {
foreach ($availableLocales as $availableLocale) {
$labels[$availableLocale->getCode()] = $product->getLabel($availableLocale->getCode());
}
}
// TODO: fix availableLocales doesn t must be NULL
foreach ($attributeAsLabel->getTranslations() as $translation) {
$labels[$translation->getLocale()] = $product->getLabel($translation->getLocale());
}
$defaultDrupalProduct = ['sku' => $product->getReference(), 'family' => $product->getFamily()->getCode(), 'created' => $product->getCreated()->format('c'), 'updated' => $product->getUpdated()->format('c'), 'status' => $product->isEnabled(), 'labels' => $labels, 'categories' => [], 'groups' => [], 'associations' => [], 'values' => []];
return $defaultDrupalProduct;
}
示例5: use
function it_normalizes_the_values_of_product(ProductInterface $product, AttributeInterface $attribute, ProductValueInterface $value, ArrayCollection $values, \ArrayIterator $iterator, $filter, $serializer)
{
$values->getIterator()->willReturn($iterator);
$product->getAssociations()->willReturn([]);
$product->getFamily()->willReturn(null);
$product->getGroupCodes()->willReturn([]);
$product->getCategoryCodes()->willReturn([]);
$product->isEnabled()->willReturn(true);
$value->getAttribute()->willReturn($attribute);
$attribute->getCode()->willReturn('name');
$product->getValues()->willReturn($values);
$filter->filter($values, Argument::any())->shouldBeCalled()->willReturn($values);
$iterator->rewind()->willReturn(null);
$valueCount = 1;
$iterator->valid()->will(function () use(&$valueCount) {
return $valueCount-- > 0;
});
$iterator->current()->willReturn($value);
$iterator->next()->willReturn(null);
$serializer->normalize($value, 'json', Argument::any())->willReturn(['locale' => null, 'scope' => null, 'value' => 'foo']);
$this->normalize($product, 'json')->shouldReturn(['family' => null, 'groups' => [], 'categories' => [], 'enabled' => true, 'associations' => [], 'values' => ['name' => [['locale' => null, 'scope' => null, 'value' => 'foo']]]]);
}
示例6:
function it_normalizes_product_with_price($filter, ProductInterface $product, AttributeInterface $priceAttribute, ProductValueInterface $price, Collection $prices, Collection $values, ProductPriceInterface $productPrice, FamilyInterface $family, SerializerInterface $serializer)
{
$family->getCode()->willReturn('shoes');
$priceAttribute->getCode()->willReturn('price');
$priceAttribute->getAttributeType()->willReturn('pim_catalog_price_collection');
$priceAttribute->isLocalizable()->willReturn(false);
$priceAttribute->isScopable()->willReturn(false);
$price->getAttribute()->willReturn($priceAttribute);
$price->getData()->willReturn(null);
$productPrice->getData()->willReturn("356.00");
$productPrice->getCurrency()->willReturn("EUR");
$prices->add($productPrice);
$price->getPrices()->willReturn($prices);
$product->getIdentifier()->willReturn($price);
$product->getFamily()->willReturn($family);
$product->isEnabled()->willReturn(true);
$product->getGroupCodes()->willReturn('group1, group2, variant_group_1');
$product->getCategoryCodes()->willReturn('nice shoes, converse');
$product->getAssociations()->willReturn([]);
$values->add($price);
$product->getValues()->willReturn($values);
$filter->filterCollection($values, 'pim.transform.product_value.flat', Argument::cetera())->willReturn([$price]);
$serializer->normalize($price, 'flat', Argument::any())->willReturn(['price-EUR' => '356.00']);
$this->normalize($product, 'flat', ['price-EUR' => ''])->shouldReturn(['price-EUR' => '356.00', 'family' => 'shoes', 'groups' => 'group1, group2, variant_group_1', 'categories' => 'nice shoes, converse', 'enabled' => 1]);
}
示例7: normalizeProperties
/**
* Normalize properties
*
* @param ProductInterface $product
*/
protected function normalizeProperties(ProductInterface $product)
{
$this->results['enabled'] = (int) $product->isEnabled();
}
示例8:
function it_normalizes_product_with_a_multiselect_value($filter, $serializer, ProductInterface $product, AbstractAttribute $skuAttribute, AbstractAttribute $colorsAttribute, AbstractProductValue $sku, AbstractProductValue $colors, AttributeOption $red, AttributeOption $blue, Collection $values, Family $family)
{
$family->getCode()->willReturn('shoes');
$skuAttribute->getCode()->willReturn('sku');
$skuAttribute->getAttributeType()->willReturn('pim_catalog_identifier');
$skuAttribute->isLocalizable()->willReturn(false);
$skuAttribute->isScopable()->willReturn(false);
$sku->getAttribute()->willReturn($skuAttribute);
$sku->getData()->willReturn('sku-001');
$colorsAttribute->getCode()->willReturn('colors');
$colorsAttribute->isLocalizable()->willReturn(false);
$colorsAttribute->isScopable()->willReturn(false);
$colors->getAttribute()->willReturn($colorsAttribute);
$colors->getData()->willReturn([$red, $blue]);
$product->getIdentifier()->willReturn($sku);
$product->getFamily()->willReturn($family);
$product->isEnabled()->willReturn(true);
$product->getGroupCodes()->willReturn('');
$product->getCategoryCodes()->willReturn('');
$product->getAssociations()->willReturn([]);
$product->getValues()->willReturn($values);
$filter->filter($values, ['identifier' => $sku, 'scopeCode' => null, 'localeCodes' => []])->willReturn([$sku, $colors]);
$serializer->normalize($sku, 'flat', Argument::any())->willReturn(['sku' => 'sku-001']);
$serializer->normalize($colors, 'flat', Argument::any())->willReturn(['colors' => 'red, blue']);
$this->normalize($product, 'flat', [])->shouldReturn(['sku' => 'sku-001', 'family' => 'shoes', 'groups' => '', 'categories' => '', 'colors' => 'red, blue', 'enabled' => 1]);
}