[11/05/2025] On remplace les modules Colissimo par le combo ColissimoHomeDelivery + ColissimoPickupPoint + ColissimoLabel
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoLabel\Request\Traits;
|
||||
|
||||
use ColissimoLabel\Request\Helper\Address;
|
||||
use Thelia\Model\Customer;
|
||||
use Thelia\Model\LangQuery;
|
||||
use Thelia\Model\OrderAddress;
|
||||
|
||||
/**
|
||||
* @author Gilles Bourgeat >gilles.bourgeat@gmail.com>
|
||||
*/
|
||||
trait MethodCreateAddressFromOrderAddress
|
||||
{
|
||||
public function createAddressFromOrderAddress(OrderAddress $orderAddress, Customer $customer)
|
||||
{
|
||||
return (new Address())
|
||||
->setCompanyName($orderAddress->getCompany())
|
||||
->setFirstName($orderAddress->getFirstname())
|
||||
->setLastName($orderAddress->getLastname())
|
||||
->setCity($orderAddress->getCity())
|
||||
->setZipCode($orderAddress->getZipcode())
|
||||
->setCountryCode($orderAddress->getCountry()->getIsoalpha2())
|
||||
->setLine2($orderAddress->getAddress1())
|
||||
->setLine3($orderAddress->getAddress2())
|
||||
->setPhoneNumber(trim(str_replace(' ', '', $orderAddress->getPhone())))
|
||||
->setMobileNumber(trim(str_replace(' ', '', $orderAddress->getCellphone())))
|
||||
->setEmail($customer->getEmail())
|
||||
->setLanguage(strtoupper(LangQuery::create()->filterByByDefault(true)->findOne()->getCode()))
|
||||
;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace ColissimoLabel\Request\Traits;
|
||||
|
||||
use ColissimoLabel\ColissimoLabel;
|
||||
use ColissimoLabel\Request\Helper\Address;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Thelia\Model\CountryQuery;
|
||||
use Thelia\Model\LangQuery;
|
||||
|
||||
/**
|
||||
* @author Gilles Bourgeat >gilles.bourgeat@gmail.com>
|
||||
*/
|
||||
trait MethodCreateAddressFromStore
|
||||
{
|
||||
public function createAddressFromStore()
|
||||
{
|
||||
return (new Address())
|
||||
->setCompanyName(ColissimoLabel::getConfigValue(ColissimoLabel::CONFIG_KEY_FROM_NAME))
|
||||
->setCity(ColissimoLabel::getConfigValue(ColissimoLabel::CONFIG_KEY_FROM_CITY))
|
||||
->setZipCode(ColissimoLabel::getConfigValue(ColissimoLabel::CONFIG_KEY_FROM_ZIPCODE))
|
||||
->setCountryCode(CountryQuery::create()->findOneById(ColissimoLabel::getConfigValue(ColissimoLabel::CONFIG_KEY_FROM_COUNTRY))->getIsoalpha2())
|
||||
->setLine2(ColissimoLabel::getConfigValue(ColissimoLabel::CONFIG_KEY_FROM_ADDRESS_1))
|
||||
->setLine3(ColissimoLabel::getConfigValue(ColissimoLabel::CONFIG_KEY_FROM_ADDRESS_2))
|
||||
->setEmail(trim(ColissimoLabel::getConfigValue(ColissimoLabel::CONFIG_KEY_FROM_CONTACT_EMAIL)))
|
||||
->setPhoneNumber(trim(str_replace(' ', '', ColissimoLabel::getConfigValue(ColissimoLabel::CONFIG_KEY_FROM_PHONE))))
|
||||
->setLanguage(strtoupper(LangQuery::create()->filterByByDefault(true)->findOne()->getCode()))
|
||||
;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user