Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Jak konwertować dane z tablicy ?
phpamator
post 21.07.2016, 12:31:28
Post #1





Grupa: Zarejestrowani
Postów: 328
Pomógł: 3
Dołączył: 10.07.2016
Skąd: UK-raine

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


Panowie, HELP!
Nie wiem jak poradzić sobie z tym problemem. Otóż:
  1. // pobieram z tabeli atrybutów dane
  2. $attribute = Mage::getModel('eav/entity_attribute')
  3. ->loadByCode('catalog_product', 'manufacturer');
  4. // na bazie listy atrybutow wybieram brand'y (nie do picia :))
  5. $brands = Mage::getResourceModel('eav/entity_attribute_option_collection')
  6. ->setAttributeFilter($attribute->getData('attribute_id'))
  7. ->setStoreFilter(0, false);
  8. // wybieran i tworzę array z id'ami gdzie 'show_brand' == 1
  9. foreach($brands as $brand){
  10. if($brand['show_brand']==1){
  11. $fbrand[] = ($brand['option_id']);
  12. }
  13. }
  14. // dostaję tablicę array(1) { [0]=> array(8) { [0]=> string(4) "1662" [1]=> string(2) "52" [2]=> string(2) "53" [3]=> string(4) "1669" [4]=> string(4) "1658" [5]=> string(2) "54" [6]=> string(4) "1666" [7]=> string(4) "1664" } }
  15. $favbrand = array($fbrand);
  16. var_dump($favbrand);
  17. $selected = Mage::getModel();
  18. $output .= "<ul class='level0 brands-ul'>";
  19. // ktora tu powinna zostac uzyta jako favbrand ...... ale nie działa :(
  20. foreach($cat_ids as $id) {
  21. if (in_array($id, $favbrand)) {
  22. $brand = Mage::getModel('catalog/category')->load($id);
  23. $image = Mage::getUrl("media/catalog/category/") . $brand->getThumbnail();
  24. $url = Mage::getUrl().$brand->getRequestPath();
  25. $output .= "<li class='brands-subnavigation'>";
  26. $output .= "<a href='{$url}'><img src='{$image}'></a>";
  27. $output .= "</li>";
  28. }
  29. }
  30.  


gdzie zrobiłem błąd ?

...
nigdzie smile.gif
Okazało się że poprostu wybrane dane nie znajdują się w drugiej tablicy smile.gif



Ten post edytował PHPRexio 21.07.2016, 13:01:38
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Wersja Lo-Fi Aktualny czas: 18.06.2025 - 06:56