-
-
Save Spriz/9b76bcfc07785d578e3c2b8df2581753 to your computer and use it in GitHub Desktop.
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
<?php | |
/** | |
* @return \Cake\Http\Response|null | |
*/ | |
public function add() | |
{ | |
$vendorId = $this->request->getData('vendor_id'); | |
if (empty($vendorId)) { | |
$vendorId = $this->request->getQuery('vendor_id'); | |
} | |
$vendor = $this->VendorProductPriceFiles->CompaniesVendors->Vendors->get($vendorId); | |
$companiesVendor = $this->CompaniesVendors->findOrCreate([ | |
'CompaniesVendors.company_id' => $this->Auth->user('company_id'), | |
'CompaniesVendors.vendor_id' => $vendor->id, | |
]); | |
if ($this->request->is(['POST'])) { | |
$companiesVendor = $this->CompaniesVendors->patchEntity($companiesVendor,[ | |
'delivery_price' => $this->request->getData('delivery_price'), | |
'free_delivery_price' => $this->request->getData('free_delivery_price'), | |
]); | |
$vendorProductPriceFile = $this->VendorProductPriceFiles->newEntity([ | |
'vendor_id' => $this->request->getData('vendor_id'), | |
'file' => $this->request->getData('file'), | |
'companies_vendor' => $companiesVendor, | |
]); | |
if ($this->VendorProductPriceFiles->save($vendorProductPriceFile)) { | |
// | |
} | |
// | |
} | |
$this->set(compact('vendor')); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment