Ok for the issue of sorting sellers by price in default_sellers.php as I don't want to change the model and have problems with each update because the change is overwritten, from your indications I made the changes in the override view, perhaps not the maximum of the optimization so if you have any suggestions let me know, here is the code:
use Joomla\Utilities\ArrayHelper;
/** @var SellaciousViewProduct $this */
$sellers = $this->item->get('sellers');
foreach ($sellers as $seller) {
$seller->sales_price = $seller->price->sales_price;
}
$sellers = ArrayHelper::sortObjects($sellers, 'sales_price');
This should be fine for now.
After sorting by price, if I wanted to order the sellers as a second criterion for feedback, how should I change the code?
$sellers = ArrayHelper::sortObjects($sellers, array( 'sales_price', 'criteria_2', 'criteria_3'));
Ok for the issue of sorting sellers by price in default_sellers.php as I don't want to change the model and have problems with each update because the change is overwritten, from your indications I made the changes in the override view, perhaps not the maximum of the optimization so if you have any suggestions let me know, here is the code:
use Joomla\Utilities\ArrayHelper;
/** @var SellaciousViewProduct $this */
$sellers = $this->item->get('sellers');
foreach ($sellers as $seller) {
$seller->sales_price = $seller->price->sales_price;
}
$sellers = ArrayHelper::sortObjects($sellers, 'sales_price');
This should be fine for now.
After sorting by price, if I wanted to order the sellers as a second criterion for feedback, how should I change the code?
$sellers = ArrayHelper::sortObjects($sellers, array( 'sales_price', 'criteria_2', 'criteria_3'));
Ok for the issue of sorting sellers by price in default_sellers.php as I don't want to change the model and have problems with each update because the change is overwritten, from your indications I made the changes in the override view, perhaps not the maximum of the optimization so if you have any suggestions let me know, here is the code:
use Joomla\Utilities\ArrayHelper;
/** @var SellaciousViewProduct $this */
$sellers = $this->item->get('sellers');
foreach ($sellers as $seller) {
$seller->sales_price = $seller->price->sales_price;
}
$sellers = ArrayHelper::sortObjects($sellers, 'sales_price');
This should be fine for now.
Ok for the issue of sorting sellers by price in default_sellers.php as I don't want to change the model and have problems with each update because the change is overwritten, from your indications I made the changes in the override view, perhaps not the maximum of the optimization so if you have any suggestions let me know, here is the code:
use Joomla\Utilities\ArrayHelper;
/** @var SellaciousViewProduct $this */
$sellers = $this->item->get('sellers');
foreach ($sellers as $seller) {
$seller->sales_price = $seller->price->sales_price;
}
$sellers = ArrayHelper::sortObjects($sellers, 'sales_price');
$obj->sales_price = $obj->price->sales_price;
$sellers = ArrayHelper::sortObjects($sellers, 'sales_price');