Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

2 Stron V   1 2 >  
Reply to this topicStart new topic
> [PHP]api allegro jak posortować wyniki
pafeu
post
Post #1





Grupa: Zarejestrowani
Postów: 69
Pomógł: 0
Dołączył: 9.10.2011

Ostrzeżenie: (0%)
-----


  1. for($i=0;$i<$limit ;$i++)
  2. {
  3. echo 'ilość ofert '.$items['user-item-list'][$i]->{'it-bid-count'}.'';
  4.  
  5. }

jak posortować wyniki malejąco?

Ten post edytował pafeu 5.01.2014, 20:31:09
Go to the top of the page
+Quote Post
Turson
post
Post #2





Grupa: Zarejestrowani
Postów: 4 291
Pomógł: 829
Dołączył: 14.02.2009
Skąd: łódź

Ostrzeżenie: (0%)
-----


http://www.php.net/manual/en/array.sorting.php
Go to the top of the page
+Quote Post
pafeu
post
Post #3





Grupa: Zarejestrowani
Postów: 69
Pomógł: 0
Dołączył: 9.10.2011

Ostrzeżenie: (0%)
-----


próbowałem ale nic mi z tego nie wyszło
Go to the top of the page
+Quote Post
rad11
post
Post #4





Grupa: Zarejestrowani
Postów: 1 270
Pomógł: 184
Dołączył: 7.10.2012
Skąd: Warszawa

Ostrzeżenie: (0%)
-----


a ktorej funkcji uzyles i w jaki sposob?
Go to the top of the page
+Quote Post
Kshyhoo
post
Post #5





Grupa: Opiekunowie
Postów: 3 855
Pomógł: 317
Dołączył: 4.01.2005
Skąd: że




Cytat
sortOptions | SortOptionsType | niewymagany
Sposób sortowania ofert.

sortType | string | niewymagany
Typ sortowania: endingTime - czas do końca/czas zakończenia (wartość domyślna dla wiekszości listingów), startingTime - czas wystawienia, price - cena, priceDelivery - cena z dostawą, popularity - popularność (liczba złożonych ofert), name - tytuł oferty.
sortOrder | string | niewymagany
Kierunek sortowania: asc - rosnąco (wartość domyślna dla większości listingów), desc - malejąco.

To to?

http://allegro.pl/webapi/documentation.php/show/id,1342
Go to the top of the page
+Quote Post
pafeu
post
Post #6





Grupa: Zarejestrowani
Postów: 69
Pomógł: 0
Dołączył: 9.10.2011

Ostrzeżenie: (0%)
-----


próbowałem użyć kilku - wiem wiem pewnie tylko jedna ma zastosowanie w tym przypadku ...
jestem słaby w php

może jakaś podpowiedź (IMG:style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
rad11
post
Post #7





Grupa: Zarejestrowani
Postów: 1 270
Pomógł: 184
Dołączył: 7.10.2012
Skąd: Warszawa

Ostrzeżenie: (0%)
-----


A pokaz jak żeś użył której kolwiek z funkcji.
Go to the top of the page
+Quote Post
pafeu
post
Post #8





Grupa: Zarejestrowani
Postów: 69
Pomógł: 0
Dołączył: 9.10.2011

Ostrzeżenie: (0%)
-----


rsort($items['user-item-list']);

ksort($items['user-item-list'][$i]->{'it-bid-count'});
Go to the top of the page
+Quote Post
rad11
post
Post #9





Grupa: Zarejestrowani
Postów: 1 270
Pomógł: 184
Dołączył: 7.10.2012
Skąd: Warszawa

Ostrzeżenie: (0%)
-----


a $items['user-item-list'] napewno jest tablica ?

Ten post edytował rad11 5.01.2014, 20:46:57
Go to the top of the page
+Quote Post
pafeu
post
Post #10





Grupa: Zarejestrowani
Postów: 69
Pomógł: 0
Dołączył: 9.10.2011

Ostrzeżenie: (0%)
-----


http://allegro.pl/webapi/documentation.php...3#method-output
Go to the top of the page
+Quote Post
rad11
post
Post #11





Grupa: Zarejestrowani
Postów: 1 270
Pomógł: 184
Dołączył: 7.10.2012
Skąd: Warszawa

Ostrzeżenie: (0%)
-----


a zrob
  1. var_dump($items['user-item-list']); die();
Go to the top of the page
+Quote Post
pafeu
post
Post #12





Grupa: Zarejestrowani
Postów: 69
Pomógł: 0
Dołączył: 9.10.2011

Ostrzeżenie: (0%)
-----


  1. array (size=12)
  2. 0 =>
  3. object(stdClass)[2]
  4. public 'it-id' => float 3833412860
  5. public 'it-name' => string 'ETUI SILIKONOWE IPOD CLASSIC VIDEO WYPRZEDAŻ' (length=45)
  6. public 'it-price' => float 10.99
  7. public 'it-buy-now-price' => float 10.99
  8. public 'it-bid-count' => int 1
  9. public 'it-time-left' => int 51698
  10. public 'it-foto-count' => int 1
  11. public 'it-is-listing-thumb' => int 1
  12. public 'it-is-bold-title' => int 0
  13. public 'it-is-buy-now' => int 1
  14. public 'it-country' => int 1
  15. public 'it-is-escrow' => int 0
  16. public 'it-starting-time' => int 0
  17. public 'it-is-reserved-price' => int 1
  18. public 'it-thumb-url' => string 'http://img12.allegroimg.pl/photos/128x96/38/33/41/28/3833412860' (length=63)
  19. public 'it-is-allegro-standard' => int 0
  20. public 'it-has-free-shipping' => int 0


Ten post edytował pafeu 5.01.2014, 20:56:31
Go to the top of the page
+Quote Post
rad11
post
Post #13





Grupa: Zarejestrowani
Postów: 1 270
Pomógł: 184
Dołączył: 7.10.2012
Skąd: Warszawa

Ostrzeżenie: (0%)
-----


a

  1. var_dump(rsort($items['user-item-list'])); die();

cos zwraca ?
Go to the top of the page
+Quote Post
pafeu
post
Post #14





Grupa: Zarejestrowani
Postów: 69
Pomógł: 0
Dołączył: 9.10.2011

Ostrzeżenie: (0%)
-----


  1. boolean true


?
Go to the top of the page
+Quote Post
rad11
post
Post #15





Grupa: Zarejestrowani
Postów: 1 270
Pomógł: 184
Dołączył: 7.10.2012
Skąd: Warszawa

Ostrzeżenie: (0%)
-----


i jak robisz

  1. rsort($items['user-item-list']);
  2.  
  3. for($i=0;$i<$limit ;$i++)
  4. {
  5. echo 'ilość ofert '.$items['user-item-list'][$i]->{'it-bid-count'}.'';
  6. }


to nic nie wyswietla ?
Go to the top of the page
+Quote Post
pafeu
post
Post #16





Grupa: Zarejestrowani
Postów: 69
Pomógł: 0
Dołączył: 9.10.2011

Ostrzeżenie: (0%)
-----


wyświetla ale nie sortuje

  1. ilość ofert 0
  2. ilość ofert 0
  3. ilość ofert 1
  4. ilość ofert 0
  5. ilość ofert 0
  6. ilość ofert 1
  7. ilość ofert 0



wydaje mi się, że trzeba się odnieść do
  1. ... {'it-bid-count'} ...
ale nie wiem jak to zrobić

Ten post edytował pafeu 5.01.2014, 21:34:49
Go to the top of the page
+Quote Post
pafeu
post
Post #17





Grupa: Zarejestrowani
Postów: 69
Pomógł: 0
Dołączył: 9.10.2011

Ostrzeżenie: (0%)
-----


  1. rsort($items['user-item-list']->{'it-bid-count'});

wywala dwa błędy
Warning: Attempt to modify property of non-object in C:\wamp\ww...
Warning: rsort() expects parameter 1 to be array, null given in C:\wamp\ww..

Ten post edytował pafeu 5.01.2014, 21:54:57
Go to the top of the page
+Quote Post
rad11
post
Post #18





Grupa: Zarejestrowani
Postów: 1 270
Pomógł: 184
Dołączył: 7.10.2012
Skąd: Warszawa

Ostrzeżenie: (0%)
-----


no to niestety Ja nie wiem jak Ci pomuc, moze poszukaj rozwiazania w metodach API tak jak kshyhoo napisal

Ten post edytował rad11 5.01.2014, 21:56:09
Go to the top of the page
+Quote Post
pafeu
post
Post #19





Grupa: Zarejestrowani
Postów: 69
Pomógł: 0
Dołączył: 9.10.2011

Ostrzeżenie: (0%)
-----


Cytat(Kshyhoo @ 5.01.2014, 20:33:39 ) *

Kshyhoo daj jakiś przykład bo ja sam z tym sobie nie poradzę (IMG:style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
ctom
post
Post #20





Grupa: Zarejestrowani
Postów: 321
Pomógł: 55
Dołączył: 19.04.2009

Ostrzeżenie: (0%)
-----


ja robisz pobieranie listy aukcji doGetItemsList to podajesz jakieś parametry wejściowe, tak ? (np. webapiKey)

teraz przeczytaj to co jest w dokumentacji co Ci link podesłał @Kshyhoo a konkretnie pkt. 4
Go to the top of the page
+Quote Post

2 Stron V   1 2 >
Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 25.08.2025 - 22:17