Magento 2覆盖admin js文件

时间:2016-08-18 05:19:25

标签: javascript magento2

如何将vendor / magento / module -configurable-product / view / adminhtml / web / js / variations / steps / summary.js覆盖到本地。我试过https://magento.stackexchange.com/questions/60276/extending-overriding-js-in-magento-2但没有运气

1 个答案:

答案 0 :(得分:3)

最后我得到了答案

我编写了一个模块,其中包含 Vendor / Module / view / adminhtml / requirejs-config.js 路径下的 requirejs-config.js 并且< / p>

#Create new labels. In this case are numbers, where 7 #correspond to the dimmensions of matrices and observations on df new.code.labels<-c(1:7) #Create new col/variable on df df$TempLabel<-new.code.labels #Recode rows and cols on matrices rownames(m1)<-new.code.labels colnames(m1)<-new.code.labels rownames(m2)<-new.code.labels colnames(m2)<-new.code.labels #Apply algorithm proposed by @jkt crit1 <- c('v1','v3') crit2 <- 'v2' #Observe I use new labels on dataframe (df$TempLabel) m11 <- m1[df$TempLabel[which(df$V %in% crit1)], df$TempLabel[which(df$V %in% crit2)]] m21 <- m2[df$TempLabel[which(df$V %in% crit1)], df$TempLabel[which(df$V %in% crit2)]] m11[!(m21<5)] <- NA m11 #To regain the original labels on results row.coded.labels.result<-rownames(m11) df.subseted.by.result.row<-subset(df, df$TempLabel %in% row.coded.labels.result) rownames(m11)<-df.subseted.by.result.row$N col.coded.labels.result<-colnames(m11) df.subseted.by.result.col<-subset(df, df$TempLabel %in% col.coded.labels.result) colnames(m11)<-df.subseted.by.result.col$N m11

While processing Json records in hive, getting the below error:- hive> select * from Json1_events_S3; OK Failed with exception java.io.IOException:org.apache.hadoop.hive.serde2.SerDeException: java.io.IOException: Field name expected Time taken: 0.328 seconds hive> select count(*) from Json1_events_S3; Query ID = bdlm_20160818033736_2a3f3c20-5cc4-48f2-969e-6340307c2f8d Total jobs = 1 Launching Job 1 out of 1`enter code here` Tez session was closed. Reopening... Session re-established. Status: Running (Executing on YARN cluster with App id application_1470837272885_0976) -------------------------------------------------------------------------------- VERTICES STATUS TOTAL COMPLETED RUNNING PENDING FAILED KILLED -------------------------------------------------------------------------------- Map 1 FAILED 1 0 0 1 4 0 reducer 2 KILLED 1 0 0 1 0 0 -------------------------------------------------------------------------------- VERTICES: 00/02 [>>--------------------------] 0% ELAPSED TIME: 17.90 s -------------------------------------------------------------------------------- Status: Failed Vertex failed, vertexName=Map 1, vertexId=vertex_1470837272885_0976_1_00, diagnostics=[Task failed, taskId=task_1470837272885_0976_1_00_000000, diagnostics=[TaskAttempt 0 failed, info=[Error: Failure while running task:java.lang.RuntimeException: java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.Hive at org.apache.hadoop.hive.ql.exec.MapOperator.process(MapOperator.java:543) at org.apache.hadoop.hive.ql.exec.tez.MapRecordSource.processRow(MapRecordSource.java:83) ... 17 more Caused by: org.apache.hadoop.hive.serde2.SerDeException: java.io.IOException: Field name expected at org.apache.hive.hcatalog.data.JsonSerDe.deserialize(JsonSerDe.java:183) at org.apache.hadoop.hive.ql.exec.MapOperator$MapOpCtx.readRow(MapOperator.java:143) at org.apache.hadoop.hive.ql.exec.MapOperator$MapOpCtx.access$200(MapOperator.java:107) at org.apache.hadoop.hive.ql.exec.MapOperator.process(MapOperator.java:534) ... 18 more Caused by: java.io.IOException: Field name expected at org.apache.hive.hcatalog.data.JsonSerDe.populateRecord(JsonSerDe.java:191) at org.apache.hive.hcatalog.data.JsonSerDe.deserialize(JsonSerDe.java:174) ... 21 more

并在供应商/模块/ view / adminhtml / web / js / variations / steps / summary-custom.js 中,我有

var config = {
    "map": {
        "*": {
            "Magento_ConfigurableProduct/js/variations/steps/summary": "Vendor_Module/js/variations/steps/summary-custom",
        }
    }
}

var config = { "map": { "*": { "Magento_ConfigurableProduct/js/variations/steps/summary": "Vendor_Module/js/variations/steps/summary-custom", } } }

我需要的是在编辑变体时显示“Msrp”和“Cost”