REDROOM
PHP 8.0.30
Path:
Logout
Edit File
Size: 2.56 KB
Close
/home/certprox/template.certproxywizard.com/wp-content/plugins/hostinger-reach/src/Dto/CartItem.php
Text
Base64
<?php namespace Hostinger\Reach\Dto; use WC_Product; class CartItem { private WC_Product $product; private int $quantity; public function __construct( int $product_id, int $quantity ) { $this->product = wc_get_product( $product_id ); $this->quantity = $quantity; } public function to_array(): array { return array( 'quantity' => $this->quantity, 'product_id' => $this->product->get_id(), 'sku' => $this->product->get_sku(), 'link' => $this->product->get_permalink(), 'name' => $this->product->get_name(), 'price' => $this->product->get_price(), 'description' => $this->product->get_description(), 'thumbnail' => $this->get_product_thumbnail( $this->product ), 'tags' => $this->get_product_tags( $this->product ), 'categories' => $this->get_categories( $this->product ), ); } public function get_categories( object $product ): array { $categories = array(); $category_ids = $product->get_category_ids(); if ( empty( $category_ids ) ) { return $categories; } foreach ( $category_ids as $category_id ) { $term = get_term( $category_id, 'product_cat' ); if ( ! $term || is_wp_error( $term ) ) { continue; } $categories[] = array( 'id' => $term->term_id, 'name' => $term->name, 'slug' => $term->slug, 'link' => get_term_link( $term ), ); } return $categories; } public function get_product_thumbnail( object $product ): string { $image_data = $product->get_image_id() ? wp_get_attachment_image_src( $product->get_image_id(), 'full' ) : array(); if ( ! empty( $image_data ) ) { return $image_data[0]; } return ''; } public function get_product_tags( object $product ): array { $tags = array(); $tag_ids = $product->get_tag_ids(); if ( empty( $tag_ids ) ) { return $tags; } foreach ( $tag_ids as $tag_id ) { $term = get_term( $tag_id, 'product_tag' ); if ( ! $term || is_wp_error( $term ) ) { continue; } $tags[] = array( 'id' => $term->term_id, 'name' => $term->name, 'slug' => $term->slug, ); } return $tags; } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 5
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
Cart.php
1.73 KB
lrw-r--r--
2026-06-10 16:30:29
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
CartItem.php
2.56 KB
lrw-r--r--
2026-06-10 16:30:29
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
PluginData.php
5.81 KB
lrw-r--r--
2026-06-10 16:30:29
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ReachContact.php
673 B
lrw-r--r--
2026-06-10 16:30:29
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Totals.php
1.77 KB
lrw-r--r--
2026-06-10 16:30:29
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).