Changeset 2835362
- Timestamp:
- 12/17/2022 05:19:27 AM (3 years ago)
- Location:
- pasazh/trunk
- Files:
-
- 2 edited
-
pasazh.php (modified) (5 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pasazh/trunk/pasazh.php
r2764016 r2835362 6 6 Plugin URI: https://epasazh.com 7 7 Description: با استفاده از این افزونه میتوانید فروشگاه خود را به پاساژ متصل نمایید. کافیست آن را فعال نمایید پس از آن به پنل مدیریت خودت در وب سایت پاساژ مراجعه نموده و ادامه مراحل جهت اتصال را تکمیل نمایید. 8 Version: 1. 48 Version: 1.5 9 9 Author: aliparsa 10 10 Author URI: https://profiles.wordpress.org/aliparsa/ … … 15 15 */ 16 16 17 const PASAZHAPI_papi_version = "1. 0";17 const PASAZHAPI_papi_version = "1.5"; 18 18 19 19 add_action('rest_api_init', function () { … … 69 69 ]; 70 70 $response["products"] = $pasazh_products; 71 72 71 73 72 return new WP_REST_Response($response, 200); … … 102 101 $pasazh_product->setId($product->get_id()); 103 102 $pasazh_product->setName($product->get_name()); 104 $pasazh_product->setDescription($product->get_description());105 103 $pasazh_product->setUrl(get_permalink($product->get_id())); 104 105 106 $description = $product->get_description(); 107 108 //get description from variations 109 if (strlen($description) == 0) { 110 111 foreach ($product->get_attributes() as $attribute) { 112 $attribute_data = json_decode(json_encode($attribute['data'], JSON_PRETTY_PRINT)); 113 $is_visible = $attribute_data->is_visible == 1; 114 if ($is_visible) { 115 $description .= $attribute_data->name . " : \r\n"; 116 $description .= implode(',', $attribute_data->options); 117 $description .= "\r\n\r\n"; 118 } 119 } 120 121 } 122 $pasazh_product->setDescription($description); 123 106 124 107 125 // region technical desc 108 126 $technical_description = ""; 109 127 $attrs = $product->get_attributes(); 110 foreach ($attrs as $attr) {128 foreach ($attrs as $attr) { 111 129 112 130 if ($attr["visible"] != true) continue; 113 131 if ($attr["variation"] == true) continue; 114 132 115 if (strlen($technical_description) >0)133 if (strlen($technical_description) > 0) 116 134 $technical_description .= "\n\n"; 117 135 $data = $attr->get_data(); 118 136 $technical_description .= $data["name"] . " : \n"; 119 137 $options_text = ""; 120 foreach ($data["options"] as $option) {138 foreach ($data["options"] as $option) { 121 139 if (strlen($options_text) > 0) 122 $options_text .= " | ";123 $options_text .= $option;124 125 } 126 $technical_description .= $options_text ;140 $options_text .= " | "; 141 $options_text .= $option; 142 143 } 144 $technical_description .= $options_text; 127 145 } 128 146 … … 161 179 $quantity = $product->get_stock_quantity(); 162 180 } else { 163 if ($product->is_in_stock()){181 if ($product->is_in_stock()) { 164 182 $quantity = 1; 165 183 } -
pasazh/trunk/readme.txt
r2764016 r2835362 5 5 Requires at least: 5.0.3 6 6 Tested up to: 5.9.3 7 Stable tag: 1. 47 Stable tag: 1.5 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 23 23 == Screenshots == 24 24 == Changelog == 25 = 1. 4=25 = 1.5 = 26 26 * First release 27 27 == Upgrade Notice ==
Note: See TracChangeset
for help on using the changeset viewer.