Total : 0.00 €

Before contacting us, please make sure to check our F.A.Q

Please, login or register to our website in order to be able to post a presale question in the forum.

× WooPrice Calculator PRO

[SOLVED] Modifying woo-price-calculator.php - Cart and Checkout Variation output

More
2 years 2 months ago - 2 years 2 months ago #357 by Josh Terrell
Josh Terrell replied the topic: Modifying woo-price-calculator.php - Cart and Checkout Variation output
I figured out my problem. I wasn't escaping the quotes. The following works:
$title[]                    = "<dt>{$label}</dt><dd>{$htmlElement}</dd>";
                    }

                    return "{$productTitle}<br/><dl class=\"uk-description-list\">" . implode("", $title) . "</dl>";

and
if($value === "on"){
                    return "<i class=\"fa fa-check-square-o fa-2x\"></i>";
                }else{
                    return "<i class=\"fa fa-square-o fa-2x\"></i>";
                }
Last Edit: 2 years 2 months ago by Josh Terrell.

Please Log in or Create an account to join the conversation.

More
2 years 2 months ago - 2 years 2 months ago #356 by Josh Terrell
Josh Terrell created the topic: [SOLVED] Modifying woo-price-calculator.php - Cart and Checkout Variation output
Hello,

I want to clean up the way the variations are displayed in the Cart and the Checkout forms. I am trying to modify the following function:
/*
         * Eseguito in review-order.php per rivedere l'ordine
         */
        /*WPC-PRO*/
        function woocommerce_checkout_cart_item_quantity($productTitle, $cartItem){
            if(isset($cartItem['simulator_id'])){
                $simulatorId            = $cartItem['simulator_id'];

                if(!empty($simulatorId)){
                    $simulatorFieldsIds     = $this->calculatorHelper->get_simulator_fields($simulatorId);
                    $simulatorFields        = $this->fieldHelper->get_fields_by_ids($simulatorFieldsIds);
                    $simulatorFieldsData    = $cartItem['simulator_fields_data'];

                    foreach($simulatorFields as $simulatorKey => $simulatorField){
                        $fieldId                    = $this->plugin_short_code . '_' . $simulatorField->id;
                        
                        $label                      = $this->wsf->userTrans($simulatorField->label);
                        $value                      = $simulatorFieldsData[$fieldId];

                        $htmlElement                = $this->getReviewElement($simulatorField, $value);
                        $title[]                    = "&emsp;&emsp;<b>{$label}:</b> {$htmlElement}";
                    }

                    return "{$productTitle}<br/><small>" . implode("<br/>", $title) . "</small><br/>";
                }else{
                    return $productTitle; // Nessuna modifica se non è un simulatore
                }
            }
        }

Instead of breaks I want to use the following description list elements similar to the default Woocommerce variation list(but with UIKIT styling):
$title[]                    = "<dt>{$label}</dt><dd>{$htmlElement}</dd>";
                    }

                    return "{$productTitle}<br/><dl class="uk-description-list">" . implode("", $title) . "</dl>";

The problem is, whenever I attempt to use any HTML syntax with a class, I get an internal 500 error and the entire website will not load. I have the same problem when I try to replace the Check and X images with font awesome icons in the following lines:
public function getReviewElement($field, $value){
            if($field->type == "checkbox"){
                $tickImageUrl       = $this->wsf->getImageUrl("tick.png");
                $crossImageUrl      = $this->wsf->getImageUrl("cross.png");
                
                if($value === "on"){
                    return "<i class="fa fa-check-square-o fa-2x"></i>";
                }else{
                    return "<i class="fa fa-square-o fa-2x"></i>";
                }
Last Edit: 2 years 2 months ago by Josh Terrell.

Please Log in or Create an account to join the conversation.

Moderators: david
Time to create page: 0.144 seconds

Cart

Total : 0.00 €