Find Jobs
Hire Freelancers

Shopify custom xml code

€8-30 EUR

已取消
已发布超过 10 年前

€8-30 EUR

货到付款
Hello i have a shopify site, and i am using a custom xml php for create a custom xml file. My problem is that the xml has only values from [login to view URL] and i would like to include a collection id from collections.json. Here is the code: $sc = new ShopifyPrivateAppClient(getShop(), getAPIKey(), getAPIPassword()); $outdata = $sc->call('GET', '/admin/[login to view URL]'); $outObj = json_encode($outdata); if (isset($outObj->errors)) { //file_put_contents("[login to view URL]", $outObj, FILE_APPEND); } else { $outObj = json_decode($outObj); $products = array(); foreach ($outObj as $obj) { foreach ($obj->variants as $variant) { $product = new stdClass(); $product->id = $obj->id; $product->sku = $variant->sku; $product->title = $obj->title; $product->link = getStoreurl() . "/products/" . $obj->handle; $product->image = ""; $product->type = $obj->product_type; $product->price = $variant->price; $product->instock = $variant->inventory_quantity > 0 ? 'Y' : 'N'; $product->color = $variant->option3; $product->categoryID = ""; $product->vendor = $obj->vendor; $product->description = $obj->body_html; $product->weight = $variant->grams; foreach ($obj->images as $image) { $product->image = $image->src; } array_push($products, $product); } } $mywebstore = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><mywebstore/>'); /* append it to the document created */ $date = date('Y/m/d H:i:s'); $mywebstore->addChild("created_at", $date); $productsroot = $mywebstore->addChild("products"); foreach ($products as $product) { $singleproduct = $productsroot->addChild("product"); $singleproduct->addAttribute("ID", $product->id); $singleproduct->addChild("UniqueID", $product->sku); $singleproduct->addChild("Title", $product->title); $singleproduct->addChild("url", $product->link); $singleproduct->addChild("Image", $product->image); $cat = $singleproduct->addChild("Category", $product->type); $cat->addAttribute("ID", $product->categoryID); $singleproduct->addChild("Price", $product->price); $singleproduct->addChild("Instock", $product->instock); $singleproduct->addChild("Availability", "Σε απόθεμα"); $singleproduct->addChild("Manufacturer", $product->vendor); $singleproduct->addChild("Description", $product->description); $singleproduct->addChild("Weight", $product->weight); $singleproduct->addChild("Color", $product->color); $singleproduct->addChild("Shipping", ""); I need in categoryID Field to have the collection id from collection.json. Is something very simple so my budget is 10€
项目 ID: 5449211

关于此项目

2提案
远程项目
活跃10 年前

想赚点钱吗?

在Freelancer上竞价的好处

设定您的预算和时间范围
为您的工作获得报酬
简要概述您的提案
免费注册和竞标工作

关于客户

GREECE的国旗
Chalkis, Greece
5.0
59
付款方式已验证
会员自11月 6, 2008起

客户认证

谢谢!我们已通过电子邮件向您发送了索取免费积分的链接。
发送电子邮件时出现问题。请再试一次。
已注册用户 发布工作总数
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
加载预览
授予地理位置权限。
您的登录会话已过期而且您已经登出,请再次登录。