We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Extra comma in order

Development and Programming

flaboi's avatar
flaboi
1 posts
8 years ago
flaboi's avatar flaboi

Hello,

When I view an order and look at the accessories section, it will always have an extra comma at the end:

Charger, Box,

Instead of:

Charger, Box

This is what my code is, please let me know what I did wrong.

Thank you!

<?php if($accepted_offer->accessories != ''): ?>
                        <div class="item">
                            <b>Accessories:</b>
                            <?php foreach (explode(',', $accepted_offer->accessories) as $accessory): ?>
                                <?= htmlspecialchars(isset($accessories[$accessory])?$accessories[$accessory]->title:'Deleted') ?>,
                            <?php endforeach ?>
       
Ingmar Greil's avatar
Ingmar Greil
29,243 posts
8 years ago
Ingmar Greil's avatar Ingmar Greil

Use the Channel Entries Tag and make use of the backspace= parameter.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.