-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the ability to specify delivery-options for the offer (#28)
- Loading branch information
1 parent
abb6bd1
commit 6375fbf
Showing
5 changed files
with
273 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Bukashk0zzzYmlGenerator | ||
* | ||
* (c) Denis Golubovskiy <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Bukashk0zzz\YmlGenerator\Tests; | ||
|
||
use Bukashk0zzz\YmlGenerator\Model\Delivery; | ||
use Bukashk0zzz\YmlGenerator\Model\Offer\OfferSimple; | ||
|
||
/** | ||
* Generator test | ||
*/ | ||
class OfferDeliveryOptionsGeneratorTest extends AbstractGeneratorTest | ||
{ | ||
/** | ||
* Test generate | ||
*/ | ||
public function testGenerate() | ||
{ | ||
$this->offerType = 'OfferDeliveryOptions'; | ||
$this->runGeneratorTest(); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function createOffer() | ||
{ | ||
$delivery = (new Delivery())->setCost(10)->setDays(1)->setOrderBefore(14); | ||
|
||
return (new OfferSimple()) | ||
->setName($this->faker->name) | ||
->setVendor($this->faker->company) | ||
->setVendorCode(null) | ||
->setPickup(true) | ||
->addDeliveryOption($delivery) | ||
->addDeliveryOption($delivery) | ||
->setGroupId($this->faker->numberBetween()) | ||
->addPicture('http://example.com/example.jpeg') | ||
->addBarcode($this->faker->ean13) | ||
->setCategoriesId([1, 2, 3]) | ||
->setCategoryId(999) | ||
; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,177 @@ | ||
<!ELEMENT yml_catalog (shop)> | ||
<!ATTLIST yml_catalog | ||
date CDATA #REQUIRED> | ||
|
||
<!ELEMENT shop (name, company, url, phone?, platform?, version?, agency?, email*, currencies, categories, delivery-options, store?, pickup?, delivery?, deliveryIncluded?, local_delivery_cost?, adult?, offers)> | ||
<!ELEMENT company (#PCDATA)> | ||
<!ELEMENT phone (#PCDATA)> | ||
|
||
<!ELEMENT currencies (currency+)> | ||
<!ELEMENT currency EMPTY> | ||
<!ATTLIST currency | ||
id (RUR|RUB|USD|BYR|KZT|EUR|UAH) #REQUIRED | ||
rate CDATA "1" | ||
plus CDATA "0"> | ||
|
||
|
||
<!ELEMENT categories (category+)> | ||
<!ELEMENT category (#PCDATA)> | ||
<!ATTLIST category | ||
id CDATA #REQUIRED | ||
parentId CDATA #IMPLIED | ||
tid CDATA #IMPLIED | ||
yid CDATA #IMPLIED> | ||
|
||
<!ELEMENT delivery-options (option+)> | ||
<!ELEMENT option EMPTY> | ||
<!ATTLIST option | ||
cost CDATA #REQUIRED | ||
days CDATA #REQUIRED | ||
order-before CDATA #IMPLIED> | ||
|
||
<!ELEMENT offers (offer+)> | ||
<!ELEMENT offer ( | ||
url?, | ||
buyurl?, | ||
price, | ||
oldprice?, | ||
wprice?, | ||
currencyId, | ||
xCategory?, | ||
categoryId+, | ||
market_category?, | ||
picture*, | ||
pickup?, | ||
delivery?, | ||
local_delivery_cost?, | ||
weight?, | ||
name, | ||
vendor?, | ||
description?, | ||
sales_notes?, | ||
manufacturer_warranty?, | ||
country_of_origin?, | ||
downloadable?, | ||
adult?, | ||
cpa?, | ||
barcode*, | ||
delivery-options, | ||
store?, | ||
deliveryIncluded?, | ||
orderingTime?, | ||
vendorCode?, | ||
aliases?, | ||
additional*, | ||
promo?, | ||
age?, | ||
param*, | ||
related_offer* | ||
)> | ||
<!ATTLIST offer | ||
id CDATA #IMPLIED | ||
group_id CDATA #IMPLIED | ||
type (vendor.model | book | audiobook | artist.title | tour | ticket | event-ticket) #IMPLIED | ||
available (true | false) #IMPLIED | ||
bid CDATA #IMPLIED | ||
cbid CDATA #IMPLIED> | ||
|
||
<!ELEMENT url (#PCDATA)> | ||
<!ELEMENT store (#PCDATA)> | ||
<!ELEMENT email (#PCDATA)> | ||
<!ELEMENT platform (#PCDATA)> | ||
<!ELEMENT version (#PCDATA)> | ||
<!ELEMENT agency (#PCDATA)> | ||
<!ELEMENT buyurl (#PCDATA)> | ||
<!ELEMENT picture (#PCDATA)> | ||
<!ELEMENT pickup (#PCDATA)> | ||
<!ELEMENT delivery (#PCDATA)> | ||
<!ELEMENT deliveryIncluded EMPTY> | ||
<!ELEMENT local_delivery_cost (#PCDATA)> | ||
<!ELEMENT orderingTime (onstock?, ordering, deliveryTime?)> | ||
<!ELEMENT onstock EMPTY> | ||
<!ELEMENT ordering (#PCDATA)> | ||
<!ATTLIST ordering | ||
hours CDATA #IMPLIED> | ||
|
||
<!ELEMENT deliveryTime EMPTY> | ||
<!ELEMENT price (#PCDATA)> | ||
<!ELEMENT oldprice (#PCDATA)> | ||
<!ELEMENT wprice (#PCDATA)> | ||
<!ELEMENT currencyId (#PCDATA)> | ||
<!ELEMENT categoryId (#PCDATA)> | ||
<!ATTLIST categoryId | ||
type (Yandex | Torg | Own) "Own" > | ||
|
||
<!ELEMENT market_category (#PCDATA)> | ||
<!ELEMENT typePrefix (#PCDATA)> | ||
<!ELEMENT vendor (#PCDATA)> | ||
<!ELEMENT vendorCode (#PCDATA)> | ||
<!ELEMENT model (#PCDATA)> | ||
<!ELEMENT author (#PCDATA)> | ||
<!ELEMENT name (#PCDATA)> | ||
<!ELEMENT publisher (#PCDATA)> | ||
<!ELEMENT ISBN (#PCDATA)> | ||
<!ELEMENT volume (#PCDATA)> | ||
<!ELEMENT part (#PCDATA)> | ||
<!ELEMENT language (#PCDATA)> | ||
<!ELEMENT binding (#PCDATA)> | ||
<!ELEMENT page_extent (#PCDATA)> | ||
<!ELEMENT table_of_contents (#PCDATA)> | ||
<!ELEMENT performed_by (#PCDATA)> | ||
<!ELEMENT performance_type (#PCDATA)> | ||
<!ELEMENT storage (#PCDATA)> | ||
<!ELEMENT format (#PCDATA)> | ||
<!ELEMENT recording_length (#PCDATA)> | ||
<!ELEMENT series (#PCDATA)> | ||
<!ELEMENT year (#PCDATA)> | ||
<!ELEMENT artist (#PCDATA)> | ||
<!ELEMENT title (#PCDATA)> | ||
<!ELEMENT media (#PCDATA)> | ||
<!ELEMENT starring (#PCDATA)> | ||
<!ELEMENT director (#PCDATA)> | ||
<!ELEMENT originalName (#PCDATA)> | ||
<!ELEMENT country (#PCDATA)> | ||
<!ELEMENT description (#PCDATA)> | ||
<!ELEMENT sales_notes (#PCDATA)> | ||
<!ELEMENT promo (#PCDATA)> | ||
<!ELEMENT aliases (#PCDATA)> | ||
<!ELEMENT provider (#PCDATA)> | ||
<!ELEMENT tarifplan (#PCDATA)> | ||
<!ELEMENT xCategory (#PCDATA)> | ||
<!ELEMENT additional (#PCDATA)> | ||
<!ELEMENT worldRegion (#PCDATA)> | ||
<!ELEMENT region (#PCDATA)> | ||
<!ELEMENT days (#PCDATA)> | ||
<!ELEMENT dataTour (#PCDATA)> | ||
<!ELEMENT hotel_stars (#PCDATA)> | ||
<!ELEMENT room (#PCDATA)> | ||
<!ELEMENT meal (#PCDATA)> | ||
<!ELEMENT included (#PCDATA)> | ||
<!ELEMENT transport (#PCDATA)> | ||
<!ELEMENT price_min (#PCDATA)> | ||
<!ELEMENT price_max (#PCDATA)> | ||
<!ELEMENT options (#PCDATA)> | ||
<!ELEMENT manufacturer_warranty (#PCDATA)> | ||
<!ELEMENT country_of_origin (#PCDATA)> | ||
<!ELEMENT downloadable (#PCDATA)> | ||
<!ELEMENT adult (#PCDATA)> | ||
<!ELEMENT age (#PCDATA)> | ||
<!ELEMENT weight (#PCDATA)> | ||
<!ELEMENT barcode (#PCDATA)> | ||
<!ELEMENT param (#PCDATA)> | ||
<!ATTLIST param | ||
name CDATA #REQUIRED | ||
unit CDATA #IMPLIED> | ||
<!ELEMENT related_offer (#PCDATA)> | ||
|
||
<!ELEMENT place (#PCDATA)> | ||
<!ELEMENT hall (#PCDATA)> | ||
<!ATTLIST hall | ||
plan CDATA #IMPLIED> | ||
|
||
<!ELEMENT hall_part (#PCDATA)> | ||
<!ELEMENT is_premiere (#PCDATA)> | ||
<!ELEMENT is_kids (#PCDATA)> | ||
<!ELEMENT date (#PCDATA)> | ||
<!ELEMENT cpa (#PCDATA)> | ||
|