-
Notifications
You must be signed in to change notification settings - Fork 2
Shipping method with pickup places - zasilkovna #6
Conversation
boris-brtan
commented
Jul 26, 2018
Q | A |
---|---|
Description, reason for the PR | we want to try extensibility of shopsys framework |
New feature | Yes |
BC breaks | Yes |
Fixes issues | #3 |
Standards and tests pass | Yes/No |
Have you read and signed our License Agreement for contributions? | Yes |
4b31c93
to
f64a89f
Compare
Please add entry to changelog... |
f64a89f
to
dce2b8d
Compare
58c3b7e
to
18ab5c9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My review is done. It was a little bigger than I expected. Please check it :)
// $this->doTestExtendedEntityInstantiation(OrderItem::class, ExtendedOrderTransport::class, self::ORDER_TRANSPORT_ID); | ||
// $this->doTestExtendedEntityInstantiation(OrderPayment::class, ExtendedOrderPayment::class, self::ORDER_PAYMENT_ID); | ||
// $this->doTestExtendedEntityInstantiation(OrderProduct::class, ExtendedOrderProduct::class, self::ORDER_PRODUCT_ID); | ||
// $this->doTestExtendedEntityInstantiation(OrderTransport::class, ExtendedOrderTransport::class, self::ORDER_TRANSPORT_ID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this code commented out? Is it on purpose? Or just some forgotten change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was a big mistake, forgotten changes after searching for tests failing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solved
{{ form_row(form.companyTaxNumber, { label: 'Tax number'|trans }) }} | ||
</div> | ||
</fieldset> | ||
<div id="js-company-and-delivery-address-fields"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you add this new div? Id js-company-and-delivery-address-fields is never used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solved
{{ form_row(form.deliveryAddressFilled, { | ||
attr: { class: 'js-checkbox-toggle', 'data-checkbox-toggle-container-id': 'js-delivery-address-fields' }, | ||
label: 'I want to deliver products to different address than the billing one'|trans, | ||
disabled: pickupPlaceDelivery}) }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pickupPlaceDelivery contains information about the fact if transport is already checked and this checked transport is pickUpPlace type. Am I right? If so, please consider renaming the variable like "isSelectedPickupPlaceTypeTransport". I mean, you should be capable to recognize the content of the variable only by variable name. Don't you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solved
use Shopsys\FrameworkBundle\Model\Transport\Transport; | ||
use Shopsys\FrameworkBundle\Model\Transport\TransportDataFactory; | ||
use Shopsys\FrameworkBundle\Model\Transport\TransportFactory; | ||
use Shopsys\FrameworkBundle\Model\Transport\TransportDataFactoryInterface; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am kind of confused with your usage of interfaces. In a class VatFacadeTest
you changed Shopsys\FrameworkBundle\Model\Transport\TransportDataFactory
=> Shopsys\ShopBundle\Model\Transport\TransportDataFactory
. In this class TransportDomainTest
you changed Shopsys\FrameworkBundle\Model\Transport\TransportDataFactory
=> Shopsys\FrameworkBundle\Model\Transport\ TransportDataFactoryInterface
. Please, explain it to me? Why did you choose TransportDataFactoryInterface and sometimes just TransportDataFactory from ShopBundle?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My mistake,
should be the key as in services_test.yml, so Shopsys\FrameworkBundle\Model\Transport\ TransportDataFactoryInterface is correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
if ($orderPersonalInfoForm.find('#order_personal_info_form_deliveryAddressFilled').is(':checked')) { | ||
var pickUpPlaceTransport = $orderPersonalInfoForm.find('.js-pick-up-place-hide-if-chosen').hasClass('display-none'); | ||
var deliveryAddressFilled = $orderPersonalInfoForm.find('#order_personal_info_form_deliveryAddressFilled').is(':checked'); | ||
if (deliveryAddressFilled && !pickUpPlaceTransport) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this condition part !pickUpPlaceTransport
necessary? Explain it to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the shipping address is filled just from backend system, there is no need for checking whether it is valid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im not sure, if checking selection of pickup place by class display-none is the correct way. There must be some other way how you can't decide whether pickup place was chosen or not. An finally change pickUpPlaceTransport to isSelectedPickUpPlaceTransport
return $orderData; | ||
} | ||
|
||
private function fillPickUpPlaceDeliveryData(OrderData $orderData, FrontOrderData $frontOrderData) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, shipping address form is disabled and that is the reason why u need to fill the delivery address from chosen pickupPlace. Am I right? But if you set the shipping address form on readonly instead of disabled, this method will be unnecessary. Correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after consultation, no change needed
$orderData->companyNumber = null; | ||
$orderData->companyTaxNumber = null; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about:
$orderData = new OrderData();
parent:: getOrderDataFromFrontOrderData($orderData);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parent:: getOrderDataFromFrontOrderData($orderData)
public function getOrderDataFromFrontOrderData(FrontOrderData $frontOrderData)
{
$orderData = $this->orderDataFactory->create();
i tried to use use
/** @var \Shopsys\ShopBundle\Model\Order\OrderData $orderData */
$orderData = parent:: getOrderDataFromFrontOrderData($orderData);
/** | ||
* @var \Shopsys\ShopBundle\Model\PickUpPlace\PickUpPlace|null | ||
*/ | ||
public $pickUpPlace; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing constructor with default value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solved
} | ||
parent::__construct($orderData, $orderNumber, $urlHash, $user); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about edit() method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solved
CHANGELOG.md
Outdated
- [#6 - Shipping method with pickup places](https://github.com/shopsys/demoshop/pull/6) | ||
- transport, Order entities and forms are extended | ||
- PickUpPlace entity is added | ||
- cronmodule for download of pick up places is created |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the description "Added new shipping method Zasilkovna. Pick up places downloaded by cron." would be enough. Im not sure that "transport, Order entities and forms are extended" is not too detailed for CHANGELOG.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solved
migrations-lock.yml
Outdated
class: Shopsys\FrameworkBundle\Migrations\Version20180724105136 | ||
skip: false | ||
20180724060204: | ||
class: Shopsys\FrameworkBundle\Migrations\Version20180724060204 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why add two migrations in a single commit?
247c21a
to
6e08203
Compare
{{ form_row(form.deliveryCountry, { label: 'Country'|trans }) }} | ||
</div> | ||
</fieldset> | ||
<fieldset> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation
|
||
/** | ||
* @param \Shopsys\ShopBundle\Model\Transport\TransportData $transportData | ||
* @param \Shopsys\ShopBundle\Model\Transport\Transport $transport |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think one of this param shoud be return.
} else { | ||
$orderData->companyName = null; | ||
$orderData->companyNumber = null; | ||
$orderData->companyTaxNumber = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost done, probably this "company" part is not necessary too.
ad76f04
to
e832f5f
Compare
Hi @boris-brtan, tests and review are done. I like it. Thank you for this new feature :) |
e832f5f
to
1b8f445
Compare
- transport, Order entities and forms are extended - PickUpPlace entity is added - cronmodule for downloading of pick up places is created
1b8f445
to
f992809
Compare