fbpx
0
The problem is this I started working on the override of the product detail view before your last changes and now I need to merge my changes and yours and I realized that you added some functions that I don't understand use.
For example, is there an array $listingsByType that seems empty what should it contain and why is it empty? I see that there is a function that under quantity management should make something linked to an overrides default_listings.php come out but how should it work?

Another question I have arranged the default_sellers.php view graphically but you have told us that it is possible to sort the offers by price or other criteria but I can't find anything in the code to manage the ordering how can I do?

Giovanni
Attachments (1)
Accepted Answer
Aditya Chakraborty Accepted Answer Pending Moderation
Team
  1. Replied one week ago
  2. #Permalink
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?


For sorting in multiple criteria, you can do it like below:


$sellers = ArrayHelper::sortObjects($sellers, array( 'sales_price', 'criteria_2', 'criteria_3'));


But you need to know which property to want to use.
Replies (8)
Aditya Chakraborty Accepted Answer Pending Moderation
Team
  1. Replied 3 weeks ago
  2. #Permalink
Hello Giovanni,

Hope you're doing well.

$listingsByType contains the number of new/used listings for a product and default_listings.php layout shows the products for new/used listings.

Regarding sellers in default_sellers.php, you would have to code the sorting on components/com_sellacious/models/product.php inside getItemSellers method -

Inside the $sellerUids loop, put following after line 692:


$obj->sales_price = $obj->price->sales_price;


And put this after foreach loop ends after line 699:


$sellers = ArrayHelper::sortObjects($sellers, 'sales_price');


This will sort sellers by price in ascending order.
Hope this helps.

Regards,
Aditya
bindCommerce Accepted Answer Pending Moderation
  1. Replied 3 weeks ago
  2. #Permalink
Ok clear thanks, but because $listingsByType is now empty if there are various offers for the product I'm looking at?

https://passalibro.martcommerce.net/index.php?option=com_sellacious&view=product&p=P12038V0S872

in fact being the array empty even if I recover your code I don't see anything under the quantities.
bindCommerce Accepted Answer Pending Moderation
  1. Replied 3 weeks ago
  2. #Permalink
And for question of sort offers of sellers on default_sellers.php your suggestion is to make a modification to the model but this then creates a problem with each update, isn't there a way in the override view?
bindCommerce Accepted Answer Pending Moderation
  1. Replied 3 weeks ago
  2. #Permalink
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');
Aditya Chakraborty Accepted Answer Pending Moderation
Team
  1. Replied 3 weeks ago
  2. #Permalink
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.
bindCommerce Accepted Answer Pending Moderation
  1. Replied 2 weeks ago
  2. #Permalink
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?
bindCommerce Accepted Answer Pending Moderation
  1. Replied one week ago
  2. #Permalink
Ok thanks, all clear, I modified it like this:
use Joomla\Utilities\ArrayHelper;
use Sellacious\Price\PriceHelper;

/** @var SellaciousViewProduct $this */
$sellers = $this->item->get('sellers');
foreach ($sellers as $seller) {
$seller->sales_price = $seller->price->sales_price;
$seller->rating = $seller->seller_rating->rating;
}
$sellers = ArrayHelper::sortObjects($sellers, array( 'sales_price', 'rating'));
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.
Support is Online
Support Hours
Monday To Saturday
From 09:00 To 21:00 IST
Sellacious Time 00:00:00

Login

?
?