Changeset 3757554
- Timestamp:
- 10/20/2026 11:21:09 PM (2 weeks ago)
- Location:
- skyservers-promo-campaigns/trunk
- Files:
-
- 5 edited
-
includes/class-skypc-frontend.php (modified) (3 diffs)
-
languages/skyservers-promo-campaigns-ro_RO.mo (modified) ( previous)
-
languages/skyservers-promo-campaigns-ro_RO.po (modified) (14 diffs)
-
readme.txt (modified) (4 diffs)
-
skyservers-promo-campaigns.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
skyservers-promo-campaigns/trunk/includes/class-skypc-frontend.php
r3755119 r3757554 31 31 32 32 add_action( 'woocommerce_checkout_create_order_line_item', array( __CLASS__, 'order_line_item' ), 10, 4 ); 33 add_action( 'woocommerce_checkout_create_order', array( __CLASS__, 'order_created' ), 20, 2 ); 33 34 34 35 add_action( 'wp_enqueue_scripts', array( __CLASS__, 'assets' ) ); … … 450 451 return; 451 452 } 452 $s = SkyPC_Settings::get(); 453 $base = self::money_text( $values['data'], SkyPC_Campaign::base_price( $values['data'] ) ); 453 $s = SkyPC_Settings::get(); 454 $base_amount = SkyPC_Campaign::base_price( $values['data'] ); 455 $base = self::money_text( $values['data'], $base_amount ); 456 $qty = isset( $values['quantity'] ) ? max( 1, (int) $values['quantity'] ) : 1; 454 457 $item->add_meta_data( 455 458 __( 'Campaign', 'skyservers-promo-campaigns' ), … … 462 465 true 463 466 ); 467 // Hidden, structured values for the reports screen. 464 468 $item->add_meta_data( '_skypc_campaign', $s['name'], true ); 469 $item->add_meta_data( '_skypc_base_price', wc_format_decimal( $base_amount, 2 ), true ); 470 $item->add_meta_data( '_skypc_price', wc_format_decimal( $p, 2 ), true ); 471 $item->add_meta_data( '_skypc_discount', wc_format_decimal( max( 0, $base_amount - $p ) * $qty, 2 ), true ); 472 } 473 474 /** 475 * Order-level totals for the reports screen, written once when the order is created. 476 * Runs after the line items exist; reads the cart so it uses the same prices the customer paid. 477 */ 478 public static function order_created( $order, $data ) { 479 if ( ! $order instanceof WC_Order || ! function_exists( 'WC' ) || ! WC()->cart ) { 480 return; 481 } 482 $discount = 0.0; 483 $items = 0; 484 foreach ( WC()->cart->get_cart() as $cart_item ) { 485 $p = self::cart_line_price( $cart_item ); 486 if ( null === $p ) { 487 continue; 488 } 489 $qty = isset( $cart_item['quantity'] ) ? max( 1, (int) $cart_item['quantity'] ) : 1; 490 $discount += max( 0, SkyPC_Campaign::base_price( $cart_item['data'] ) - $p ) * $qty; 491 $items += $qty; 492 } 493 if ( $items <= 0 ) { 494 return; 495 } 496 $s = SkyPC_Settings::get(); 497 $order->update_meta_data( '_skypc_campaign', $s['name'] ); 498 $order->update_meta_data( '_skypc_discount', wc_format_decimal( $discount, 2 ) ); 499 $order->update_meta_data( '_skypc_items', $items ); 500 $order->update_meta_data( '_skypc_percent', wc_format_decimal( $s['percent'], 2 ) ); 501 SkyPC_Reports::remember_campaign( $s['name'], time() ); 465 502 } 466 503 -
skyservers-promo-campaigns/trunk/languages/skyservers-promo-campaigns-ro_RO.po
r3755119 r3757554 43 43 msgstr "Se aplică peste prețul curent al produsului (prețul redus, dacă există). Nu se afișează clienților decât dacă bifezi opțiunea de mai jos." 44 44 45 #: includes/class-skypc-reports.php 46 msgid "Average discount per order" 47 msgstr "Reducere medie pe comandă" 48 49 #: includes/class-skypc-reports.php 50 msgid "Average order value" 51 msgstr "Valoare medie comandă" 52 45 53 #: includes/class-skypc-admin.php 46 54 msgid "B · 2 rows, price with a marker" … … 63 71 msgstr "C · clasic, plus etichetă" 64 72 65 #: includes/class-skypc-frontend.php 73 #: includes/class-skypc-frontend.php includes/class-skypc-reports.php 66 74 msgid "Campaign" 67 75 msgstr "Campanie" 68 76 77 #: includes/class-skypc-reports.php 78 msgid "Campaign items" 79 msgstr "Bucăți din campanie" 80 81 #: includes/class-skypc-reports.php 82 msgid "Campaign items sold" 83 msgstr "Bucăți vândute din campanie" 84 69 85 #: includes/class-skypc-admin.php 70 86 msgid "Campaign name" … … 99 115 msgstr "Ora curentă a site-ului: %s." 100 116 117 #: includes/class-skypc-reports.php 118 msgid "Date" 119 msgstr "Dată" 120 121 #: includes/class-skypc-reports.php 122 msgid "Day" 123 msgstr "Ziua" 124 101 125 #: includes/class-skypc-admin.php 102 126 msgid "Discount" 103 127 msgstr "Reducere" 104 128 129 #: includes/class-skypc-reports.php 130 msgid "Discount given" 131 msgstr "Reducere oferită" 132 133 #: includes/class-skypc-reports.php 134 msgid "Discount given = the extra campaign discount, measured against the price each product had just before the campaign. Figures are cached for 10 minutes." 135 msgstr "Reducere oferită = extra reducerea campaniei, calculată față de prețul pe care îl avea fiecare produs chiar înainte de campanie. Cifrele se păstrează în cache 10 minute." 136 105 137 #: includes/class-skypc-settings.php 106 138 msgid "Down to the nearest 10 cents (107.548 → 107.50)" … … 123 155 msgstr "Excluderi" 124 156 157 #: includes/class-skypc-reports.php 158 msgid "Export orders (CSV)" 159 msgstr "Exportă comenzile (CSV)" 160 125 161 #: includes/class-skypc-admin.php 126 162 msgid "Extra discount" … … 135 171 msgstr "De exemplu produse-taxă adăugate automat lângă alte produse, care nu trebuie reduse." 136 172 173 #: includes/class-skypc-reports.php 174 msgid "From" 175 msgstr "De la" 176 137 177 #: includes/class-skypc-admin.php 138 178 msgid "Hides the coupon field and removes coupons already applied." … … 195 235 msgstr "Fără bulină" 196 236 237 #: includes/class-skypc-reports.php 238 msgid "No campaign orders yet. Orders placed while a campaign is live appear here automatically." 239 msgstr "Încă nu există comenzi din campanii. Comenzile plasate cât timp o campanie e pornită apar aici automat." 240 241 #: includes/class-skypc-reports.php 242 msgid "No orders match these filters." 243 msgstr "Nicio comandă nu se potrivește cu aceste filtre." 244 197 245 #: includes/class-skypc-admin.php 198 246 msgid "ONLY for administrators and shop managers (preview mode)" … … 202 250 msgid "Off" 203 251 msgstr "Oprită" 252 253 #: includes/class-skypc-reports.php 254 msgid "Older orders added to the statistics: %s." 255 msgstr "Comenzi vechi adăugate la statistici: %s." 256 257 #: includes/class-skypc-reports.php 258 msgid "Only needed once, for orders placed with plugin versions before 1.2. Reads the price note on each order line." 259 msgstr "E nevoie o singură dată, pentru comenzile plasate cu versiuni mai vechi de 1.2. Citește nota cu prețul de pe fiecare linie a comenzii." 260 261 #: includes/class-skypc-reports.php 262 msgid "Order" 263 msgstr "Comandă" 264 265 #: includes/class-skypc-reports.php 266 msgid "Order statuses" 267 msgstr "Statusuri comenzi" 268 269 #: includes/class-skypc-reports.php 270 msgid "Order total" 271 msgstr "Total comandă" 272 273 #: includes/class-skypc-reports.php 274 msgid "Orders" 275 msgstr "Comenzi" 204 276 205 277 #: includes/class-skypc-frontend.php … … 215 287 msgstr "Suspendă cupoanele în campanie" 216 288 289 #: includes/class-skypc-reports.php 290 msgid "Per day" 291 msgstr "Pe zile" 292 217 293 #: includes/class-skypc-admin.php 218 294 msgid "Period" … … 227 303 msgstr "Previzualizare" 228 304 305 #: includes/class-skypc-reports.php 306 msgid "Product" 307 msgstr "Produs" 308 229 309 #: includes/class-skypc-admin.php 230 310 msgid "Products in these categories (and their subcategories) get no discount and no label." … … 235 315 msgstr "Campanii promo" 236 316 317 #: includes/class-skypc-reports.php 318 msgid "Promo reports" 319 msgstr "Rapoarte promo" 320 321 #: includes/class-skypc-reports.php 322 msgid "Quantity" 323 msgstr "Cantitate" 324 325 #: includes/class-skypc-reports.php 326 msgid "Rebuild statistics for older orders" 327 msgstr "Reconstruiește statisticile pentru comenzile vechi" 328 329 #: includes/class-skypc-reports.php 330 msgid "Revenue" 331 msgstr "Încasări" 332 333 #: includes/class-skypc-reports.php 334 msgid "Revenue (order totals)" 335 msgstr "Încasări (totalurile comenzilor)" 336 237 337 #: includes/class-skypc-admin.php 238 338 msgid "Rounding" … … 254 354 msgid "Settings" 255 355 msgstr "Setări" 356 357 #: includes/class-skypc-reports.php 358 msgid "Show" 359 msgstr "Arată" 256 360 257 361 #: includes/class-skypc-admin.php … … 303 407 msgstr "Început" 304 408 305 #: includes/class-skypc-admin.php 409 #: includes/class-skypc-admin.php includes/class-skypc-reports.php 306 410 msgid "Status" 307 411 msgstr "Stare" … … 367 471 msgstr "Nu există încă nicio categorie de produse." 368 472 473 #: includes/class-skypc-reports.php 474 msgid "To" 475 msgstr "Până la" 476 369 477 #: includes/class-skypc-settings.php 370 478 msgid "To 2 decimals (107.548 → 107.55)" 371 479 msgstr "La 2 zecimale (107,548 → 107,55)" 372 480 481 #: includes/class-skypc-reports.php 482 msgid "Top products" 483 msgstr "Top produse" 484 373 485 #: includes/class-skypc-admin.php 374 486 msgid "What the sale bubble shows on product cards (home page, categories, carousels, related products). The campaign price stays visible; only the bubble changes." … … 382 494 msgid "Yes" 383 495 msgstr "Da" 496 497 #: includes/class-skypc-reports.php 498 msgid "You are not allowed to do this." 499 msgstr "Nu ai voie să faci asta." 384 500 385 501 #: includes/class-skypc-settings.php -
skyservers-promo-campaigns/trunk/readme.txt
r3755119 r3757554 6 6 Requires PHP: 7.4 7 7 Requires Plugins: woocommerce 8 Stable tag: 1. 1.18 Stable tag: 1.2.0 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 31 31 * Three price layouts, three sizes and your own colours, all from the settings screen. 32 32 * Product schema (structured data) carries the campaign price, so search engines see what shoppers see. 33 * Reports: orders, revenue, discount given, average order value, per-day breakdown and top products for each campaign, with CSV export. 33 34 34 35 **Prices that always add up** … … 77 78 == Changelog == 78 79 80 = 1.2.0 = 81 * New: WooCommerce → Promo reports. For each campaign: number of orders, revenue, discount given, average order value, average discount per order, items sold, a per-day table and the top products, filtered by period and order status, with CSV export. 82 * Orders now store the campaign discount per line and per order (hidden meta), so reports are exact. 83 * One-off tool to rebuild statistics for orders placed with earlier versions. 84 79 85 = 1.1.1 = 80 86 * New: choose what the sale bubble shows on the product page and, separately, on product cards (home page, categories, carousels): the campaign label, the theme's usual bubble, or no bubble. The campaign price is always shown. … … 90 96 == Upgrade Notice == 91 97 98 = 1.2.0 = 99 Adds the Promo reports screen. Orders placed with earlier versions appear there after you click “Rebuild statistics for older orders” once. 100 92 101 = 1.1.1 = 93 102 Adds a choice of what the sale bubble shows on product cards and on the product page. Nothing changes until you pick a different option. -
skyservers-promo-campaigns/trunk/skyservers-promo-campaigns.php
r3755119 r3757554 4 4 * Plugin URI: https://www.sky-servers.com/skyservers-promo-campaigns/ 5 5 * Description: Scheduled promo campaigns for WooCommerce: extra discount in the cart, three prices shown, campaign label and strip, coupons paused. 6 * Version: 1. 1.16 * Version: 1.2.0 7 7 * Author: Sky Servers SRL 8 8 * Author URI: https://www.sky-servers.com/ … … 22 22 } 23 23 24 define( 'SKYPC_VERSION', '1. 1.1' );24 define( 'SKYPC_VERSION', '1.2.0' ); 25 25 define( 'SKYPC_PATH', plugin_dir_path( __FILE__ ) ); 26 26 define( 'SKYPC_URL', plugin_dir_url( __FILE__ ) ); … … 30 30 require_once SKYPC_PATH . 'includes/class-skypc-rules.php'; 31 31 require_once SKYPC_PATH . 'includes/class-skypc-format.php'; 32 require_once SKYPC_PATH . 'includes/class-skypc-stats.php'; 32 33 require_once SKYPC_PATH . 'includes/class-skypc-settings.php'; 33 34 require_once SKYPC_PATH . 'includes/class-skypc-campaign.php'; … … 35 36 require_once SKYPC_PATH . 'includes/class-skypc-frontend.php'; 36 37 require_once SKYPC_PATH . 'includes/class-skypc-admin.php'; 38 require_once SKYPC_PATH . 'includes/class-skypc-reports.php'; 37 39 38 40 register_activation_hook( __FILE__, array( 'SkyPC_Settings', 'activate' ) ); … … 55 57 if ( is_admin() ) { 56 58 SkyPC_Admin::init(); 59 SkyPC_Reports::init(); 57 60 } 58 61 }
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)