Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: PHP i TPL
Forum PHP.pl > Forum > PHP
Prezi2907
Witam jak w temacie widać problem opiera się na komunikacji PHP -> TPL ...

Z tym że opierajmy się na samym TPL w którym muszę zrobić mały myk...

  1. <!-- prices -->
  2. <p class="price">
  3. {if $product->on_sale}
  4. <img src="{$img_dir}onsale_{$lang_iso}.gif" alt="{l s='On sale'}" class="on_sale_img"/>
  5. <span class="on_sale">{l s='On sale!'}</span>
  6.  
  7. {elseif ($product->reduction_price != 0 || $product->reduction_percent != 0) && ($product->reduction_from == $product->reduction_to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $product->reduction_to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $product->reduction_from))}
  8. <span class="discount">{l s='Price lowered!'}</span>
  9. {/if}
  10. <br />
  11. <span class="our_price_display">
  12. {if !$priceDisplay || $priceDisplay == 2}
  13. <span id="our_price_display">{convertPrice price=$product->getPrice(true, $smarty.const.NULL)} </span>
  14. {if $tax_enabled}{l s='tax incl.'}
  15. {/if}
  16. {/if}
  17. {if $priceDisplay == 1}
  18. <span id="our_price_display">{convertPrice price=$product->getPrice(false, $smarty.const.NULL)}</span>
  19. {if $tax_enabled}{l s='tax excl.'}{/if}
  20. {/if}
  21. </span>
  22. {if $priceDisplay == 2}
  23. <br />
  24. <span id="pretaxe_price"><span id="pretaxe_price_display">{convertPrice price=$product->getPrice(false, $smarty.const.NULL)}</span> {l s='tax excl.'}</span>
  25. {/if}
  26. <br />
  27. </p>
  28. {if ($product->reduction_price != 0 || $product->reduction_percent != 0) && ($product->reduction_from == $product->reduction_to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $product->reduction_to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $product->reduction_from))}
  29. <p id="old_price"><span class="bold">
  30. {if !$priceDisplay || $priceDisplay == 2}
  31. <span id="old_price_display">{convertPrice price=$product->getPriceWithoutReduct()}</span>
  32. {if $tax_enabled}{l s='tax incl.'}{/if}
  33. {/if}
  34. {if $priceDisplay == 1}
  35. <span id="old_price_display">{convertPrice price=$product->getPriceWithoutReduct(true)}</span>
  36. {if $tax_enabled}{l s='tax excl.'}{/if}
  37. {/if}
  38. </span>
  39. </p>
  40.  
  41. {/if}
  42. {if $product->reduction_percent != 0 && ($product->reduction_from == $product->reduction_to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $product->reduction_to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $product->reduction_from))}
  43. <p id="reduction_percent">{l s='(price reduced by'} <span id="reduction_percent_display">{$product->reduction_percent|floatval}</span> %{l s=')'}</p>
  44. {/if}
  45. {if $packItems|@count}
  46. <p class="pack_price">{l s='instead of'} <span style="text-decoration: line-through;">{convertPrice price=$product->getNoPackPrice()}</span></p>
  47. <br class="clear" />
  48. {/if}
  49. {if $product->ecotax != 0}
  50. <p class="price-ecotax">{l s='include'} <span id="ecotax_price_display">{convertPrice price=$product->ecotax}</span> {l s='for green tax'}</p>
  51. {/if}
  52.  
  53.  
  54.  
  55.  
  56. {if ZMIENNA DO CENY >= 100}
  57. <p align="center">
  58. <a href="https://jakiś_tam_sobie_system_ratalny.pl/oblicz/oblicz.php?wartoscTowarow={TU ZMIENNA DO CENY}" target="_blank"); style="cursor: pointer;"><img src="/rata.gif" title="Oblicz rate" alt="Oblicz rate" border="0" /></a></p>
  59. <p align="center"><blink><b>UWAGA!!! MASZ MOZLIWOSC ZAKUPU NA RATY !!!</b></p></blink>
  60. {else}
  61. <p align="right">Zakup na raty dostepny jest <br /><b>od 100 zl</b> wartosci produktu.</p>
  62.  
  63. {/if}


Dałem to w znaczniki php ale jest to kod TPL... Teraz... Jak widać na końcu mamy sobie moduł pewnego systemu ratalnego. Problem zaczyna się w chwili kiedy muszę podać mu zmienną do ostatniej pokazanej pętli... Proszę o pomoc jak wyciągnąć zmienną z takiego wpisu:

  1. {convertPrice price=$product->getPrice(false, $smarty.const.NULL)}


i dać ją jako np. $CennaProduktu która wskazywała by mi na dokładną lokalizację odpowiedniego punktu w skrypcie... Dla ułatwienia operujmy na podanej wyżej wartości... Można nawet do niej coś dopisać ale wole operować na nowych zmiennych...

Dla ułatwienia działam na presta shop plik product.tpl
Może ktoś się tam już bawił i będzie wiedział jak pobrać cenę z produktu do skryptu wyliczeniowego modułu ratalnego. Całą integrację już napisałem a nie wiem jak wyciągnąć tą ostatnią wartość smile.gif

Pozdrawiam i liczę na waszą pomoc.

------ odświeżam ------------

odświeżam....
Darti
Albo

  1. <a href="https://jakiś_tam_sobie_system_ratalny.pl/oblicz/oblicz.php?wartoscTowarow={$product->getPrice(false, $smarty.const.NULL)}" target="_blank"); style="cursor: pointer;">


albo

  1. {if $priceDisplay == 1}
  2. <span id="our_price_display">{convertPrice price=$product->getPrice(false, $smarty.const.NULL)}
  3. {assign var='CennaProduktu' value=$product->getPrice(false, $smarty.const.NULL)}
  4. </span>
  5. {if $tax_enabled}{l s='tax excl.'}{/if}
  6. {/if}
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.