Wie kann man in Shopware 5 die Nachkommastellen bei den Produktpreisen von 2 auf 3 umstellen?

Hallo!

Versuche mir gerade meinen eigenen kleinen Onlineshop per Shopware zu basteln, jedoch hab ich ein großes Problem :frowning:

 

Ich habe Produkte die einzeln nur 0,036 kosten.

Angeboten werden sie in 400er Schritten (also 400 * 0,036), und mit Staffelpreisen (bis 0,029)

 

Mein Problem ist nun das Shopware5 die Preise immer auf 2Dezimalstellen rundet. Also auf 0,04 oder 0,03. Das macht bei großen Stückzahlen aber einen riesigen Unterschied.

Wie kann ich es umstellen, damit Shopware auch mit 3 Dezimalstellen rechnen kann???

 

Bitte um eure Hilfe.

lg

 

 

Hat keiner eine Idee???

 

Hi,

ich habs mit ein paar Tricken hinbekommen:

Man muss es als 1. in der Grundpreisberechung hinterlegt und 2. das Template anpassen, damit die 3. Stelle nicht weggerundet wird.

Gruß Heiner

1 „Gefällt mir“

Hallo Heiner,

bei der Preiseingabe bzw. “Preisstaffelung” in der Artikel-Bearbeitungsmaske im Shopware Backend lässt Shopware doch aber gar keine Eingabe von bspw. “23,023” zu und wechselt automatisch auf “23,02”, wie und wo gibst du da eine dritte Nachkommastelle ein?

Beste Grüße

Sebastian

Hallo Heiner!

Das wäre genau das wonach ich schon so lange suche.

Leider bin ich kein Programmierer und kenn mich nur sehr beschränkt mit dem ganzen aus.

Ich hab mir das (Responsive)Template rausgesucht und kann diese Stelle niergenst finden :frowning:

Ich hab Shopware 5.1.  mit dem Responsive-Template. Kannst du mir sagen was ich da genau ändern muß???

Danke!

@denise342 schrieb:

Hallo Heiner!

Das wäre genau das wonach ich schon so lange suche.

Leider bin ich kein Programmierer und kenn mich nur sehr beschränkt mit dem ganzen aus.

Ich hab mir das (Responsive)Template rausgesucht und kann diese Stelle niergenst finden :(

Ich hab Shopware 5.1.  mit dem Responsive-Template. Kannst du mir sagen was ich da genau ändern muß???

Danke!

Hallo,

die Datei, von der du ableiten bzw. den Block überschreiben musst, ist im Ordner „frontend/detail“ und nennt sich „data.tpl“, der Block „frontend_detail_data_price_unit_reference_content“ (im Bare-Theme). Dies kannst du unter anderem auch anhand des Namens recht schnell herausfinden (frontend_detail_data_…). Näheres hier: Getting started with Shopware templating . Du müsstest alles natürlich auch in einem eigenen Theme, was am besten vom Responsive Theme von Shopware ableiten, machen.

Beste Grüße

Sebastian

Uff :frowning:

Ums kurz zu machen … für einen Laien der sich nur einen kleinen Onlineshop basteln will eigentlich nicht zu bewältigen!

Schade - ich finde Shopware sonst eigentlich super - aber das man nur mit 2 Dezimalstellen arbeiten kann ist echt ein Witz

Leider konnte ich auch kein Plugin finden das dieses Problem löst.

Einmal versuch ichs noch & geb morgen Bescheid ob ichs schaffen konnte :slight_smile:

{block name=„frontend_detail_data“} {* Rich snippet data couldn’t be in the „head“-element due to the fact that the „#detail“ element needs the schema of the data *} {block name=„frontend_detail_rich_snippets“} {* Supplier name *} {block name=„frontend_detail_rich_snippets_brand“} {/block} {* Product name *} {block name=„frontend_detail_rich_snippets_name“} {/block} {* Product image *} {block name=„frontend_detail_rich_snippets_image“} {/block} {* Product description *} {block name=„frontend_detail_rich_snippets_description“} {/block} {* Category path. Google recommend the following format: „Parent category > Child category“ *} {block name=„frontend_detail_rich_snippets_category“} {/if}{$crumb.name} {/if} {/foreach} {/strip}" /> {/block} {* Product identifier e.g the order number *} {block name=„frontend_detail_rich_snippets_identifier“} {/block} {* Currency of the price, needs to follow the ISO-4217 standard *} {block name=„frontend_detail_rich_snippets_currency“} getCurrency()->getCurrency()}" /> {/block} {* Product price *} {block name=„frontend_detail_rich_snippets_price“} {/block} {* Seller of the product e.g. our shop *} {block name=„frontend_detail_rich_snippets_seller“} {/block} {* Availability of the product *} {block name=„frontend_detail_rich_snippets_availability“} 0}in_stock{else}out_of_stock{/if}" /> {/block} {* Available quantity of the product *} {block name=„frontend_detail_rich_snippets_quantity“} {/block} {* Offer url for the product similar to the canonical tag in the „head“-element *} {block name=„frontend_detail_rich_snippets_offerUrl“} {/block} {* Aggregated review if we’re dealing with more than one vote *} {if $sArticle.sVoteAverange.count > 1} {block name=„frontend_detail_rich_snippets_review_aggregate“} {* Name of the reviewed product *} {block name=„frontend_detail_rich_snippets_review_aggregate_name“} {/block} {* Minimum points *} {block name=„frontend_detail_rich_snippets_review_aggregate_worst“} {/block} {* Maximum points *} {block name=„frontend_detail_rich_snippets_review_aggregate_best“} {/block} {* Average rating *} {block name=„frontend_detail_rich_snippets_review_aggregate_rating“} {/block} {* Vote count *} {block name=„frontend_detail_rich_snippets_review_aggregate_count“} {/block} {/block} {elseif $sArticle.sVoteAverange.count == 1} {block name=„frontend_detail_rich_snippets_review_single“} {$vote=$sArticle.sVoteComments.0} {* Name of the reviewed product *} {block name=„frontend_detail_comment_rich_snippets_name“} {/block} {* Review date, needs to follow the iso date format *} {block name=„frontend_detail_comment_rich_snippets_date“} {/block} {* Vote rating *} {block name=„frontend_detail_comment_rich_snippets_rating“} {/block} {* Vote count *} {block name=„frontend_detail_comment_rich_snippets_count“} {/block} {* Minimum points *} {block name=„frontend_detail_comment_rich_snippets_worst“} {/block} {* Maximum points *} {block name=„frontend_detail_comment_rich_snippets_best“} {/block} {* Review summary *} {block name=„frontend_detail_comment_rich_snippets_summary“} {/block} {* Name of the reviewer *} {block name=„frontend_detail_comment_rich_snippets_reviewer“} {/block} {* Review text *} {block name=„frontend_detail_comment_rich_snippets_description“} {/block} {/block} {/if} {/block} {* Caching instock status *} {if !$sView} {/if} {if $sArticle.sBlockPrices && (!$sArticle.sConfigurator || $sArticle.pricegroupActive)} {foreach from=$sArticle.sBlockPrices item=row key=key} {if $row.from==„1“} {/if} {/foreach} {else} {if !$sView} {/if} {/if} {* Order number *} {if $sArticle.ordernumber} {block name=‚frontend_detail_data_ordernumber‘}

{se name=„DetailDataId“}{/se} {$sArticle.ordernumber}

{/block} {/if} {* Attributes fields *} {block name=‚frontend_detail_data_attributes‘} {if $sArticle.attr1}

{$sArticle.attr1}

{/if} {if $sArticle.attr2}

{$sArticle.attr2}

{/if} {/block} {block name=„frontend_detail_data_delivery“} {* Delivery informations *} {if ($sArticle.sConfiguratorSettings.type != 1 && $sArticle.sConfiguratorSettings.type != 2) || $activeConfiguratorSelection == true} {include file=„frontend/plugins/index/delivery_informations.tpl“ sArticle=$sArticle} {/if} {/block} {if !$sArticle.liveshoppingData.valid_to_ts} {* Graduated prices *} {if $sArticle.sBlockPrices && !$sArticle.liveshoppingData.valid_to_ts} {* Include block prices *} {block name=„frontend_detail_data_block_price_include“} {include file=„frontend/detail/block_price.tpl“ sArticle=$sArticle} {/block} {* Article price *} {block name=‚frontend_detail_data_price_info‘}

{s namespace=„frontend/detail/data“ name=„DetailDataPriceInfo“}{/s}

{/block} {if $sArticle.purchaseunit} {* Article price *} {block name=‚frontend_detail_data_price‘}

{se name=„DetailDataInfoContent“}{/se} {$sArticle.purchaseunit} {$sArticle.sUnit.description} {if $sArticle.purchaseunit != $sArticle.referenceunit} {if $sArticle.referenceunit} ({$sArticle.referenceprice|currency} {s name=„Star“ namespace=„frontend/listing/box_article“}{/s} / {$sArticle.referenceunit} {$sArticle.sUnit.description}) {/if} {/if}

{/block} {/if} {else} {* Pseudo price *}

{if $sArticle.purchaseunit} {* Article price *} {block name=‚frontend_detail_data_price‘}
{se name=„DetailDataInfoContent“}{/se} {$sArticle.purchaseunit} {$sArticle.sUnit.description} {if $sArticle.purchaseunit != $sArticle.referenceunit} {if $sArticle.referenceunit} ({$sArticle.referenceprice|currency} {s name=„Star“ namespace=„frontend/listing/box_article“}{/s} / {$sArticle.referenceunit} {$sArticle.sUnit.description}) {/if} {/if}
{/block} {/if}
{else} class=‚article_details_price‘>{/if} {block name=‚frontend_detail_data_pseudo_price‘} {if $sArticle.has_pseudoprice} {* if $sArticle.sVariants || $sArticle.priceStartingFrom*}
{s name=„reducedPrice“ namespace=„frontend/listing/box_article“}{/s} {$sArticle.pseudoprice|currency} {s name=„Star“ namespace=„frontend/listing/box_article“}{/s} {if $sArticle.pseudopricePercent.float} ({$sArticle.pseudopricePercent.float|number}% {se name=„DetailDataInfoSavePercent“}{/se}) {/if}
{*/if*} {/if} {/block} {* Article price configurator *} {block name=‚frontend_detail_data_price_configurator‘} {if $sArticle.priceStartingFrom && !$sArticle.sConfigurator && $sView} {se name=„DetailDataInfoFrom“}{/se} {$sArticle.priceStartingFrom|currency} {s name=„Star“ namespace=„frontend/listing/box_article“}{/s} {else} {$sArticle.price|currency} {s name=„Star“ namespace=„frontend/listing/box_article“}{/s} {/if} {/block}
{* Article price *} {block name=‚frontend_detail_data_price_info‘}

{s name=„DetailDataPriceInfo“}{/s}

{/block}

{/if} {/if} {block name=„frontend_detail_data_liveshopping“} {* Liveshopping *} {if $sArticle.liveshoppingData.valid_to_ts} {if $sArticle.liveshoppingData.typeID == 2 || $sArticle.liveshoppingData.typeID == 3} {include file=„frontend/detail/liveshopping/detail_countdown.tpl“ sLiveshoppingData=$sArticle.liveshoppingData} {else} {include file=„frontend/detail/liveshopping/detail.tpl“ sLiveshoppingData=$sArticle.liveshoppingData sArticlePseudoprice=$sArticle.pseudoprice} {/if} {/if} {/block} {/block}

Ok - diesen Quellcode konnte ich finden, aber leider versteh ich nicht ganz was hier genau geschieht. Bzw. was hat das Frontend eigentlich mit meiner Preisberechnung zu tun? Im Frontend darf es gerundet sein, nur bei der Preisberechnung bräuchte ich die 3 Dezimalstellen.

Gibt es vielleicht einen barmherzigen Samariter (oder zumindest ein Plugin) der mir das umstellen könnte???

Danke :slight_smile:

Hi @denise342‍: Shopware arbeitet immer mit zwei Nachkomma-Stellen. Wir haben in einem unserer Plugins entsprechende Hooks geschrieben, die das auf 15-Nachkomma-Stellen verändern. Schreib uns gerne eine Mail (anfragen@kellerkinder.de) oder eine PM.