miccom Posted October 25, 2016 Share Posted October 25, 2016 Cześć. Potrzebuję zmodyfikować jeden z elementów Przy wyświetlaniu kary produktu wyświetla się np. : 200 produkty Chciałbym wprowadzić taki podział, aby dla niektórych elementów ( np. zaznaczonych w bazie danych jako itemID == 1) pokazywać metry bieżące ( mb ) lub dla itemID == 2 metry kwadratowe ( m2 ) itd. dla sztuk. Sznupię w w kontrolerze ProductControler.php i w product.tpl ale nie wiem jak sie do tego zabrać. Pomoże mi ktoś z Was rozkminić ten element? Proszę o pomoc. Michał Marcak Link to comment Share on other sites More sharing options...
Daresh Posted October 25, 2016 Share Posted October 25, 2016 Czyli jak rozumiem chodzi o to żeby zamiast "sztuk" pokazywało się "mb.", itd. Ja bym to zrobił tak, że jak produkt ma podaną jednostkę to w tym miejscu ją wyświetlamy, a jeżeli nie ma to "sztuk". Czyli to by tylko wymagało zmian w szablonie, bez rozgrzebywania kontrolerów. Link to comment Share on other sites More sharing options...
miccom Posted October 25, 2016 Author Share Posted October 25, 2016 No tak ale gdzie zadeklarować dla danego produktu jednostkę miary? Link to comment Share on other sites More sharing options...
Daresh Posted October 26, 2016 Share Posted October 26, 2016 Przecież przy każdym produkcie jest na to pole, tam gdzie się ceny podaje. Link to comment Share on other sites More sharing options...
miccom Posted October 26, 2016 Author Share Posted October 26, 2016 Tak, przy cenie widzę to, ale przy ilości sztuk na magazynie masz 5 przedmoty a chciałbym 5 szt. Link to comment Share on other sites More sharing options...
e_com Posted October 26, 2016 Share Posted October 26, 2016 (edited) Wyświetlanie jednostki przy ilościach w product.tpl wykonuje ten kod: <span id="pQuantityAvailable"{if $product->quantity <= 0} style="display: none;"{/if}> <span id="quantityAvailable">{$product->quantity|intval}</span> <span {if $product->quantity > 1} style="display: none;"{/if} id="quantityAvailableTxt">{l s='Item'}</span> <span {if $product->quantity == 1} style="display: none;"{/if} id="quantityAvailableTxtMultiple">{l s='Items'}</span> </span> Jest mały problem jeśli mamy sklep multilang i używamy jednostek typu "bla bla", a nie ISO, np. sztuka, bo pole w produkcie nie jest multilang. Ale jako tłumacza możemy wykorzystać smarty: <span id="pQuantityAvailable"{if $product->quantity <= 0} style="display: none;"{/if}> <span id="quantityAvailable">{$product->quantity|intval}</span> <span {if $product->quantity > 1} style="display: none;"{/if} id="quantityAvailableTxt">{if $product->unity == m2}m<sup>2</sup>{elseif $product->unity == "szt" && $lang_iso == "en"}pcs{elseif $product->unity == "szt" && $lang_iso == "de"}Stk{else}{$product->unity|escape:'html':'UTF-8'}{/if}</span> <span {if $product->quantity == 1} style="display: none;"{/if} id="quantityAvailableTxtMultiple">{if $product->unity == m2}m<sup>2</sup>{elseif $product->unity == "szt" && $lang_iso == "en"}pcs{elseif $product->unity == "szt" && $lang_iso == "de"}Stk{else}{$product->unity|escape:'html':'UTF-8'}{/if}</span> </span> Przy okazji dorzuciłem "uśliczniacz" jednostki miary z górnym sufiksem, czyli m2. W product-list.tpl też możemy rozwinąć wodze naszej fantazji w tym temacie, tylko zmienna jest {$product.unity}. Edited October 26, 2016 by e_com (see edit history) 1 Link to comment Share on other sites More sharing options...
miccom Posted October 28, 2016 Author Share Posted October 28, 2016 Piękne dzięki Kod podmieniony, teraz czy jest możliwość dodania z poziomu panelu administracyjnego product->unity?W bazie danych mam wszystkie rekordy unity albo puste albo 'null' Link to comment Share on other sites More sharing options...
Daresh Posted October 28, 2016 Share Posted October 28, 2016 Przy produkcie w zakładce Ceny tam gdzie jest cena jednostkowa i "za" to właśnie tam się podaje unity. 1 Link to comment Share on other sites More sharing options...
miccom Posted October 28, 2016 Author Share Posted October 28, 2016 (edited) Ok, działa Dziękuję bardzo za pomoc Edited October 28, 2016 by miccom (see edit history) Link to comment Share on other sites More sharing options...
karolkrakowiak Posted February 26, 2017 Share Posted February 26, 2017 Mam część towaru na metry, a część na sztuki, jak uzależnić jednostki, w jakich plikach i z jakimi tabelami w bazie. Domniemam, że chodzi o product.tpl i kolumnę unity w tabeli product. Ale nie wiem, jak zrobić taki warunek w kodzie. Pomóżcie, proszę, bo nie wiem, jak się do tego zabrać. Link to comment Share on other sites More sharing options...
endriu107 Posted February 26, 2017 Share Posted February 26, 2017 Opisz konkretnie o co chodzi. Link to comment Share on other sites More sharing options...
() Maciej () Posted February 27, 2017 Share Posted February 27, 2017 To może ja dorzucę też od siebie mały problem z jednostkami. Mam obecnie sklep postawiony na wersji 1.5.4.1 i do tego w Multistore (bez wersji językowych i innych walut niż podstawowa). Ma za to moduł integrujący z programem magazynowym, który tworzy 4 rodzaje cen przy produkcie (detal + 3 ceny dodatkowe hurt 1, detal -10%, detal -15%). Wszystko oparte na grupach klientów, którzy mają przypisaną odpowiednią grupę cenową. Jak teraz wprowadzić informacje o tym, że np sznurek jest sprzedawany na metry. Pole unity będzie działać prawidłowo jak wprowadzę też cenę poprawną. Tyle, że w tym przypadku nie mogę tego zrobić ze względu na 4 poziomy cenowe. Macie jakiś pomysł jak to rozwiązać ? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now